Changeset 103294 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Dec 19, 2011, 7:16:21 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r103292 r103294 1 2011-12-19 Gavin Barraclough <[email protected]> 2 3 https://bugs.webkit.org/show_bug.cgi?id=74903 4 Exceptions not thrown correctly from DFG JIT on 32bit 5 6 Reviewed by Oliver Hunt. 7 8 Arguments for lookupExceptionHandler are not setup correctly. 9 In the case of ARMv7 we rely on lr being preserved over a call, 10 this in invalid. On x86 we don't should be poking the arguments onto the stack! 11 12 * bytecode/CodeBlock.h: 13 (JSC::CodeBlock::bytecodeOffsetForCallAtIndex): 14 * dfg/DFGAssemblyHelpers.h: 15 (JSC::DFG::AssemblyHelpers::restoreReturnAddressBeforeReturn): 16 * dfg/DFGGPRInfo.h: 17 * dfg/DFGJITCompiler.cpp: 18 (JSC::DFG::JITCompiler::compileBody): 19 * dfg/DFGJITCompiler.h: 20 (JSC::DFG::JITCompiler::addExceptionCheck): 21 (JSC::DFG::JITCompiler::addFastExceptionCheck): 22 * dfg/DFGOperations.cpp: 23 * dfg/DFGOperations.h: 24 1 25 2011-12-19 Filip Pizlo <[email protected]> 2 26 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r102917 r103294 371 371 } 372 372 373 unsigned bytecodeOffsetForCallAtIndex(unsigned index) 374 { 375 if (!m_rareData) 376 return 1; 377 Vector<CallReturnOffsetToBytecodeOffset>& callIndices = m_rareData->m_callReturnIndexVector; 378 if (!callIndices.size()) 379 return 1; 380 ASSERT(index < m_rareData->m_callReturnIndexVector.size()); 381 return m_rareData->m_callReturnIndexVector[index].bytecodeOffset; 382 } 383 373 384 void unlinkCalls(); 374 385 -
trunk/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h
r102743 r103294 76 76 push(address); 77 77 } 78 79 void getPCAfterCall(GPRReg gpr)80 {81 peek(gpr, -1);82 }83 78 #endif // CPU(X86_64) || CPU(X86) 84 79 … … 97 92 { 98 93 loadPtr(address, linkRegister); 99 }100 101 ALWAYS_INLINE void getPCAfterCall(GPRReg gpr)102 {103 move(ARMRegisters::lr, gpr);104 94 } 105 95 #endif -
trunk/Source/JavaScriptCore/dfg/DFGGPRInfo.h
r99895 r103294 274 274 static const GPRReg returnValueGPR = X86Registers::eax; // regT0 275 275 static const GPRReg returnValueGPR2 = X86Registers::edx; // regT1 276 static const GPRReg nonPreservedNonReturnGPR = X86Registers::ecx; 276 277 277 278 static GPRReg toRegister(unsigned index) … … 344 345 static const GPRReg returnValueGPR = X86Registers::eax; // regT0 345 346 static const GPRReg returnValueGPR2 = X86Registers::edx; // regT1 347 static const GPRReg nonPreservedNonReturnGPR = X86Registers::esi; 346 348 347 349 static GPRReg toRegister(unsigned index) … … 416 418 static const GPRReg returnValueGPR = ARMRegisters::r0; // regT0 417 419 static const GPRReg returnValueGPR2 = ARMRegisters::r1; // regT1 420 static const GPRReg nonPreservedNonReturnGPR = ARMRegisters::r2; 418 421 419 422 static GPRReg toRegister(unsigned index) -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r102545 r103294 96 96 if (didLinkExceptionCheck) { 97 97 // lookupExceptionHandler is passed two arguments, exec (the CallFrame*), and 98 // an identifier for the operation that threw the exception, which we can use99 // to look up handler information. The identifier we use is the return address100 // of the call out from JIT code that threw the exception; this is still101 // available on the stack, just below the stack pointer!98 // the index into the CodeBlock's callReturnIndexVector corresponding to the 99 // call that threw the exception (this was set in nonPreservedNonReturnGPR, when 100 // the exception check was planted). 101 move(GPRInfo::nonPreservedNonReturnGPR, GPRInfo::argumentGPR1); 102 102 move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 103 getPCAfterCall(GPRInfo::argumentGPR1); 103 #if CPU(X86) 104 // FIXME: should use the call abstraction, but this is currently in the SpeculativeJIT layer! 105 poke(GPRInfo::argumentGPR0); 106 poke(GPRInfo::argumentGPR1, 1); 107 #endif 104 108 m_calls.append(CallLinkRecord(call(), lookupExceptionHandler)); 105 109 // lookupExceptionHandler leaves the handler CallFrame* in the returnValueGPR, -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h
r102743 r103294 179 179 Call addExceptionCheck(Call functionCall, CodeOrigin codeOrigin) 180 180 { 181 move(TrustedImm32(m_exceptionChecks.size()), GPRInfo::nonPreservedNonReturnGPR); 181 182 #if USE(JSVALUE64) 182 183 Jump exceptionCheck = branchTestPtr(NonZero, AbsoluteAddress(&globalData()->exception)); … … 191 192 Call addFastExceptionCheck(Call functionCall, CodeOrigin codeOrigin) 192 193 { 194 move(TrustedImm32(m_exceptionChecks.size()), GPRInfo::nonPreservedNonReturnGPR); 193 195 Jump exceptionCheck = branchTestPtr(Zero, GPRInfo::returnValueGPR); 194 196 m_exceptionChecks.append(CallExceptionRecord(functionCall, exceptionCheck, codeOrigin)); -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r103083 r103294 794 794 } 795 795 796 DFGHandlerEncoded DFG_OPERATION lookupExceptionHandler(ExecState* exec, ReturnAddressPtr faultLocation)796 DFGHandlerEncoded DFG_OPERATION lookupExceptionHandler(ExecState* exec, uint32_t callIndex) 797 797 { 798 798 JSValue exceptionValue = exec->exception(); 799 799 ASSERT(exceptionValue); 800 800 801 unsigned vPCIndex = exec->codeBlock()->bytecodeOffset (faultLocation);801 unsigned vPCIndex = exec->codeBlock()->bytecodeOffsetForCallAtIndex(callIndex); 802 802 HandlerInfo* handler = exec->globalData().interpreter->throwException(exec, exceptionValue, vPCIndex); 803 803 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r102811 r103294 181 181 } 182 182 #endif 183 DFGHandlerEncoded DFG_OPERATION lookupExceptionHandler(ExecState*, ReturnAddressPtr faultLocation);183 DFGHandlerEncoded DFG_OPERATION lookupExceptionHandler(ExecState*, uint32_t); 184 184 185 185 // These operations implement the implicitly called ToInt32, ToNumber, and ToBoolean conversions from ES5.
Note:
See TracChangeset
for help on using the changeset viewer.