Changeset 39366 in webkit for trunk/JavaScriptCore
- Timestamp:
- Dec 17, 2008, 1:25:40 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r39362 r39366 1 2008-12-17 Sam Weinig <[email protected]> 2 3 Reviewed by Darin Adler. 4 5 Fix for https://bugs.webkit.org/show_bug.cgi?id=22897 6 <rdar://problem/6428342> 7 Look into feasibility of discarding bytecode after native codegen 8 9 Clear the bytecode Instruction vector at the end JIT generation. 10 11 Saves 4.8 MB on Membuster head. 12 13 * bytecode/CodeBlock.cpp: 14 (JSC::CodeBlock::dump): Add logging for the case that someone tries 15 to dump the instructions of a CodeBlock that has had its bytecode 16 vector cleared. 17 (JSC::CodeBlock::CodeBlock): Initialize the instructionCount 18 (JSC::CodeBlock::handlerForBytecodeOffset): Use instructionCount instead 19 of the size of the instruction vector in the assertion. 20 (JSC::CodeBlock::lineNumberForBytecodeOffset): Ditto. 21 (JSC::CodeBlock::expressionRangeForBytecodeOffset): Ditto. 22 (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset): Ditto. 23 (JSC::CodeBlock::functionRegisterForBytecodeOffset): Ditto. 24 * bytecode/CodeBlock.h: 25 (JSC::CodeBlock::setInstructionCount): Store the instruction vector size 26 in debug builds for assertions. 27 * bytecompiler/BytecodeGenerator.cpp: 28 (JSC::BytecodeGenerator::generate): 29 * jit/JIT.cpp: 30 (JSC::JIT::privateCompile): Clear the bytecode vector unless we 31 have compiled with Opcode sampling where we will continue to require it 32 1 33 2008-12-17 Cary Clark <[email protected]> 2 34 -
trunk/JavaScriptCore/bytecode/CodeBlock.cpp
r39354 r39366 35 35 #include "Interpreter.h" 36 36 #include "Debugger.h" 37 #include "BytecodeGenerator.h" 37 38 #include <stdio.h> 38 39 #include <wtf/StringExtras.h> … … 323 324 void CodeBlock::dump(ExecState* exec) const 324 325 { 326 if (m_instructions.isEmpty()) { 327 printf("No instructions available.\n"); 328 return; 329 } 330 325 331 size_t instructionCount = 0; 326 332 … … 1173 1179 , m_ownerNode(ownerNode) 1174 1180 , m_globalData(0) 1181 #ifndef NDEBUG 1182 , m_instructionCount(0) 1183 #endif 1175 1184 , m_needsFullScopeChain(ownerNode->needsActivation()) 1176 1185 , m_usesEval(ownerNode->usesEval()) … … 1330 1339 HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset) 1331 1340 { 1341 ASSERT(bytecodeOffset < m_instructionCount); 1342 1332 1343 if (!m_rareData) 1333 1344 return 0; 1334 1335 ASSERT(bytecodeOffset < m_instructions.size());1336 1345 1337 1346 Vector<HandlerInfo>& exceptionHandlers = m_rareData->m_exceptionHandlers; … … 1348 1357 int CodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset) 1349 1358 { 1350 ASSERT(bytecodeOffset < m_instruction s.size());1359 ASSERT(bytecodeOffset < m_instructionCount); 1351 1360 1352 1361 if (!m_lineInfo.size()) … … 1370 1379 int CodeBlock::expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset) 1371 1380 { 1372 ASSERT(bytecodeOffset < m_instruction s.size());1381 ASSERT(bytecodeOffset < m_instructionCount); 1373 1382 1374 1383 if (!m_expressionInfo.size()) { … … 1406 1415 bool CodeBlock::getByIdExceptionInfoForBytecodeOffset(unsigned bytecodeOffset, OpcodeID& opcodeID) 1407 1416 { 1408 ASSERT(bytecodeOffset < m_instruction s.size());1417 ASSERT(bytecodeOffset < m_instructionCount); 1409 1418 1410 1419 if (!m_getByIdExceptionInfo.size()) … … 1431 1440 bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex) 1432 1441 { 1433 ASSERT(bytecodeOffset < m_instruction s.size());1442 ASSERT(bytecodeOffset < m_instructionCount); 1434 1443 1435 1444 if (!m_rareData || !m_rareData->m_functionRegisterInfos.size()) … … 1451 1460 functionRegisterIndex = m_rareData->m_functionRegisterInfos[low - 1].functionRegisterIndex; 1452 1461 return true; 1462 } 1463 1464 void CodeBlock::setJITCode(JITCodeRef& jitCode) 1465 { 1466 m_jitCode = jitCode; 1467 #if !ENABLE(OPCODE_SAMPLING) 1468 if (!BytecodeGenerator::dumpsGeneratedCode()) 1469 m_instructions.clear(); 1470 #endif 1453 1471 } 1454 1472 #endif -
trunk/JavaScriptCore/bytecode/CodeBlock.h
r39354 r39366 307 307 308 308 Vector<Instruction>& instructions() { return m_instructions; } 309 310 #if ENABLE(JIT) 311 void setJITCode(JITCodeRef& jitCode) { m_jitCode = jitCode; } 309 #ifndef NDEBUG 310 void setInstructionCount(unsigned instructionCount) { m_instructionCount = instructionCount; } 311 #endif 312 313 #if ENABLE(JIT) 314 void setJITCode(JITCodeRef& jitCode); 312 315 void* jitCode() { return m_jitCode.code; } 313 316 ExecutablePool* executablePool() { return m_jitCode.executablePool.get(); } … … 440 443 441 444 Vector<Instruction> m_instructions; 445 #ifndef NDEBUG 446 unsigned m_instructionCount; 447 #endif 442 448 #if ENABLE(JIT) 443 449 JITCodeRef m_jitCode; -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r39354 r39366 128 128 } 129 129 130 bool BytecodeGenerator::dumpsGeneratedCode() 131 { 132 #ifndef NDEBUG 133 return s_dumpsGeneratedCode; 134 #else 135 return false; 136 #endif 137 } 138 130 139 void BytecodeGenerator::generate() 131 140 { … … 135 144 136 145 #ifndef NDEBUG 146 m_codeBlock->setInstructionCount(m_codeBlock->instructions().size()); 147 137 148 if (s_dumpsGeneratedCode) { 138 149 JSGlobalObject* globalObject = m_scopeChain->globalObject(); -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r39255 r39366 67 67 68 68 static void setDumpsGeneratedCode(bool dumpsGeneratedCode); 69 static bool dumpsGeneratedCode(); 69 70 70 71 BytecodeGenerator(ProgramNode*, const Debugger*, const ScopeChain&, SymbolTable*, ProgramCodeBlock*);
Note:
See TracChangeset
for help on using the changeset viewer.