Changeset 39354 in webkit for trunk/JavaScriptCore
- Timestamp:
- Dec 16, 2008, 10:30:17 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r39351 r39354 1 2008-12-16 Sam Weinig <[email protected]> 2 3 Reviewed by Geoffrey Garen. 4 5 Fix for https://bugs.webkit.org/show_bug.cgi?id=22838 6 Remove dependency on the bytecode Instruction buffer in Interpreter::throwException 7 Part of <rdar://problem/6428342> 8 9 * bytecode/CodeBlock.cpp: 10 (JSC::CodeBlock::functionRegisterForBytecodeOffset): Added. Function to get 11 a function Register index in a callFrame for a bytecode offset. 12 (JSC::CodeBlock::shrinkToFit): Shrink m_getByIdExceptionInfo and m_functionRegisterInfos. 13 * bytecode/CodeBlock.h: 14 (JSC::FunctionRegisterInfo::FunctionRegisterInfo): Added. 15 (JSC::CodeBlock::addFunctionRegisterInfo): 16 * bytecompiler/BytecodeGenerator.cpp: 17 (JSC::BytecodeGenerator::emitCall): 18 * interpreter/Interpreter.cpp: 19 (JSC::Interpreter::throwException): Use functionRegisterForBytecodeOffset in JIT 20 mode. 21 1 22 2008-12-16 Sam Weinig <[email protected]> 2 23 -
trunk/JavaScriptCore/bytecode/CodeBlock.cpp
r39284 r39354 1428 1428 } 1429 1429 1430 #if ENABLE(JIT) 1431 bool CodeBlock::functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex) 1432 { 1433 ASSERT(bytecodeOffset < m_instructions.size()); 1434 1435 if (!m_rareData || !m_rareData->m_functionRegisterInfos.size()) 1436 return false; 1437 1438 int low = 0; 1439 int high = m_rareData->m_functionRegisterInfos.size(); 1440 while (low < high) { 1441 int mid = low + (high - low) / 2; 1442 if (m_rareData->m_functionRegisterInfos[mid].bytecodeOffset <= bytecodeOffset) 1443 low = mid + 1; 1444 else 1445 high = mid; 1446 } 1447 1448 if (!low || m_rareData->m_functionRegisterInfos[low - 1].bytecodeOffset != bytecodeOffset) 1449 return false; 1450 1451 functionRegisterIndex = m_rareData->m_functionRegisterInfos[low - 1].functionRegisterIndex; 1452 return true; 1453 } 1454 #endif 1455 1430 1456 void CodeBlock::shrinkToFit() 1431 1457 { … … 1444 1470 m_expressionInfo.shrinkToFit(); 1445 1471 m_lineInfo.shrinkToFit(); 1472 m_getByIdExceptionInfo.shrinkToFit(); 1446 1473 1447 1474 m_identifiers.shrinkToFit(); … … 1457 1484 m_rareData->m_characterSwitchJumpTables.shrinkToFit(); 1458 1485 m_rareData->m_stringSwitchJumpTables.shrinkToFit(); 1486 #if ENABLE(JIT) 1487 m_rareData->m_functionRegisterInfos.shrinkToFit(); 1488 #endif 1459 1489 } 1460 1490 } -
trunk/JavaScriptCore/bytecode/CodeBlock.h
r39285 r39354 129 129 }; 130 130 131 struct FunctionRegisterInfo { 132 FunctionRegisterInfo(unsigned bytecodeOffset, int functionRegisterIndex) 133 : bytecodeOffset(bytecodeOffset) 134 , functionRegisterIndex(functionRegisterIndex) 135 { 136 } 137 138 unsigned bytecodeOffset; 139 int functionRegisterIndex; 140 }; 141 131 142 struct GlobalResolveInfo { 132 143 GlobalResolveInfo() … … 291 302 return binaryChop<PC, void*, getNativePC>(m_pcVector.begin(), m_pcVector.size(), nativePC)->bytecodeIndex; 292 303 } 304 305 bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex); 293 306 #endif 294 307 … … 350 363 void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); } 351 364 CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; } 365 366 void addFunctionRegisterInfo(unsigned bytecodeOffset, int functionIndex) { createRareDataIfNecessary(); m_rareData->m_functionRegisterInfos.append(FunctionRegisterInfo(bytecodeOffset, functionIndex)); } 352 367 353 368 Vector<PC>& pcVector() { return m_pcVector; } … … 481 496 482 497 EvalCodeCache m_evalCodeCache; 498 499 #if ENABLE(JIT) 500 Vector<FunctionRegisterInfo> m_functionRegisterInfos; 501 #endif 483 502 }; 484 503 -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r39255 r39354 1257 1257 emitOpcode(op_profile_will_call); 1258 1258 instructions().append(func->index()); 1259 1260 #if ENABLE(JIT) 1261 m_codeBlock->addFunctionRegisterInfo(instructions().size(), func->index()); 1262 #endif 1259 1263 } 1260 1264 -
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r39351 r39354 833 833 // we'll never reach the relevant op_profile_did_call. 834 834 if (Profiler* profiler = *Profiler::enabledProfilerReference()) { 835 #if !ENABLE(JIT) 835 836 if (isCallBytecode(codeBlock->instructions()[bytecodeOffset].u.opcode)) 836 837 profiler->didExecute(callFrame, callFrame[codeBlock->instructions()[bytecodeOffset + 2].u.operand].jsValue(callFrame)); 837 838 else if (codeBlock->instructions()[bytecodeOffset + 8].u.opcode == getOpcode(op_construct)) 838 839 profiler->didExecute(callFrame, callFrame[codeBlock->instructions()[bytecodeOffset + 10].u.operand].jsValue(callFrame)); 840 #else 841 int functionRegisterIndex; 842 if (codeBlock->functionRegisterForBytecodeOffset(bytecodeOffset, functionRegisterIndex)) 843 profiler->didExecute(callFrame, callFrame[functionRegisterIndex].jsValue(callFrame)); 844 #endif 839 845 } 840 846
Note:
See TracChangeset
for help on using the changeset viewer.