Changeset 48662 in webkit for trunk/JavaScriptCore/bytecode
- Timestamp:
- Sep 22, 2009, 5:40:58 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/bytecode
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecode/EvalCodeCache.h
r47738 r48662 51 51 52 52 if (!evalExecutable) { 53 evalExecutable = EvalExecutable::create( makeSource(evalSource));53 evalExecutable = EvalExecutable::create(exec, makeSource(evalSource)); 54 54 exceptionValue = evalExecutable->compile(exec, scopeChain); 55 55 if (exceptionValue) -
trunk/JavaScriptCore/bytecode/SamplingTool.cpp
r47412 r48662 158 158 159 159 160 void Sc opeSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC)160 void ScriptSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC) 161 161 { 162 162 if (!m_samples) { … … 197 197 #if ENABLE(CODEBLOCK_SAMPLING) 198 198 if (CodeBlock* codeBlock = sample.codeBlock()) { 199 MutexLocker locker(m_sc opeSampleMapMutex);200 Sc opeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable());199 MutexLocker locker(m_scriptSampleMapMutex); 200 ScriptSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); 201 201 ASSERT(record); 202 202 record->sample(codeBlock, sample.vPC()); … … 210 210 } 211 211 212 void SamplingTool::notifyOfScope(Sc opeNode* scope)212 void SamplingTool::notifyOfScope(ScriptExecutable* script) 213 213 { 214 214 #if ENABLE(CODEBLOCK_SAMPLING) 215 MutexLocker locker(m_sc opeSampleMapMutex);216 m_scopeSampleMap->set(sc ope, new ScopeSampleRecord(scope));215 MutexLocker locker(m_scriptSampleMapMutex); 216 m_scopeSampleMap->set(script, new ScriptSampleRecord(script)); 217 217 #else 218 UNUSED_PARAM(sc ope);218 UNUSED_PARAM(script); 219 219 #endif 220 220 } … … 255 255 } 256 256 257 static int compareSc opeSampleRecords(const void* left, const void* right)258 { 259 const Sc opeSampleRecord* const leftValue = *static_cast<const ScopeSampleRecord* const *>(left);260 const Sc opeSampleRecord* const rightValue = *static_cast<const ScopeSampleRecord* const *>(right);257 static int compareScriptSampleRecords(const void* left, const void* right) 258 { 259 const ScriptSampleRecord* const leftValue = *static_cast<const ScriptSampleRecord* const *>(left); 260 const ScriptSampleRecord* const rightValue = *static_cast<const ScriptSampleRecord* const *>(right); 261 261 262 262 return (leftValue->m_sampleCount < rightValue->m_sampleCount) ? 1 : (leftValue->m_sampleCount > rightValue->m_sampleCount) ? -1 : 0; … … 319 319 320 320 int scopeCount = m_scopeSampleMap->size(); 321 Vector<Sc opeSampleRecord*> codeBlockSamples(scopeCount);322 Sc opeSampleRecordMap::iterator iter = m_scopeSampleMap->begin();321 Vector<ScriptSampleRecord*> codeBlockSamples(scopeCount); 322 ScriptSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); 323 323 for (int i = 0; i < scopeCount; ++i, ++iter) 324 324 codeBlockSamples[i] = iter->second; 325 325 326 qsort(codeBlockSamples.begin(), scopeCount, sizeof(Sc opeSampleRecord*), compareScopeSampleRecords);326 qsort(codeBlockSamples.begin(), scopeCount, sizeof(ScriptSampleRecord*), compareScriptSampleRecords); 327 327 328 328 // (4) Print data from 'codeBlockSamples' array. … … 331 331 332 332 for (int i = 0; i < scopeCount; ++i) { 333 Sc opeSampleRecord* record = codeBlockSamples[i];333 ScriptSampleRecord* record = codeBlockSamples[i]; 334 334 CodeBlock* codeBlock = record->m_codeBlock; 335 335 … … 338 338 if (blockPercent >= 1) { 339 339 //Instruction* code = codeBlock->instructions().begin(); 340 printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_ scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent);340 printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_executable->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForBytecodeOffset(exec, 0), record->m_sampleCount, m_sampleCount, blockPercent); 341 341 if (i < 10) { 342 342 HashMap<unsigned,unsigned> lineCounts; -
trunk/JavaScriptCore/bytecode/SamplingTool.h
r46528 r48662 39 39 namespace JSC { 40 40 41 class ScriptExecutable; 42 41 43 class SamplingFlags { 42 44 friend class JIT; … … 93 95 struct Instruction; 94 96 95 struct Sc opeSampleRecord {96 Sc opeSampleRecord(ScopeNode* scope)97 : m_ scope(scope)97 struct ScriptSampleRecord { 98 ScriptSampleRecord(ScriptExecutable* executable) 99 : m_executable(executable) 98 100 , m_codeBlock(0) 99 101 , m_sampleCount(0) … … 104 106 } 105 107 106 ~Sc opeSampleRecord()108 ~ScriptSampleRecord() 107 109 { 108 110 if (m_samples) … … 112 114 void sample(CodeBlock*, Instruction*); 113 115 114 RefPtr<ScopeNode> m_scope;116 ScriptExecutable* m_executable; 115 117 CodeBlock* m_codeBlock; 116 118 int m_sampleCount; … … 120 122 }; 121 123 122 typedef WTF::HashMap<Sc opeNode*, ScopeSampleRecord*> ScopeSampleRecordMap;124 typedef WTF::HashMap<ScriptExecutable*, ScriptSampleRecord*> ScriptSampleRecordMap; 123 125 124 126 class SamplingThread { … … 194 196 , m_opcodeSampleCount(0) 195 197 #if ENABLE(CODEBLOCK_SAMPLING) 196 , m_scopeSampleMap(new Sc opeSampleRecordMap())198 , m_scopeSampleMap(new ScriptSampleRecordMap()) 197 199 #endif 198 200 { … … 211 213 void dump(ExecState*); 212 214 213 void notifyOfScope(Sc opeNode* scope);215 void notifyOfScope(ScriptExecutable* scope); 214 216 215 217 void sample(CodeBlock* codeBlock, Instruction* vPC) … … 267 269 268 270 #if ENABLE(CODEBLOCK_SAMPLING) 269 Mutex m_sc opeSampleMapMutex;270 OwnPtr<Sc opeSampleRecordMap> m_scopeSampleMap;271 Mutex m_scriptSampleMapMutex; 272 OwnPtr<ScriptSampleRecordMap> m_scopeSampleMap; 271 273 #endif 272 274 };
Note:
See TracChangeset
for help on using the changeset viewer.