void JITCompiler::compileExceptionHandlers() { // Iterate over the m_calls vector, checking for jumps to link. bool didLinkExceptionCheck = false; for (unsigned i = 0; i < m_exceptionChecks.size(); ++i) { Jump& exceptionCheck = m_exceptionChecks[i].m_exceptionCheck; if (exceptionCheck.isSet()) { exceptionCheck.link(this); didLinkExceptionCheck = true; } } // If any exception checks were linked, generate code to lookup a handler. if (didLinkExceptionCheck) { // lookupExceptionHandler is passed two arguments, exec (the CallFrame*), and // the index into the CodeBlock's callReturnIndexVector corresponding to the // call that threw the exception (this was set in nonPreservedNonReturnGPR, when // the exception check was planted). move(GPRInfo::nonPreservedNonReturnGPR, GPRInfo::argumentGPR1); move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); #if CPU(X86) // FIXME: should use the call abstraction, but this is currently in the SpeculativeJIT layer! poke(GPRInfo::argumentGPR0); poke(GPRInfo::argumentGPR1, 1); #endif m_calls.append(CallLinkRecord(call(), lookupExceptionHandler)); // lookupExceptionHandler leaves the handler CallFrame* in the returnValueGPR, // and the address of the handler in returnValueGPR2. jump(GPRInfo::returnValueGPR2); } }
void JITCompiler::compileExceptionHandlers() { if (m_exceptionChecks.empty() && m_exceptionChecksWithCallFrameRollback.empty()) return; Jump doLookup; if (!m_exceptionChecksWithCallFrameRollback.empty()) { m_exceptionChecksWithCallFrameRollback.link(this); emitGetCallerFrameFromCallFrameHeaderPtr(GPRInfo::argumentGPR0); doLookup = jump(); } if (!m_exceptionChecks.empty()) m_exceptionChecks.link(this); // lookupExceptionHandler is passed one argument, the exec (the CallFrame*). move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); if (doLookup.isSet()) doLookup.link(this); #if CPU(X86) // FIXME: should use the call abstraction, but this is currently in the SpeculativeJIT layer! poke(GPRInfo::argumentGPR0); #endif m_calls.append(CallLinkRecord(call(), lookupExceptionHandler)); jumpToExceptionHandler(); }
void JITCompiler::compileExceptionHandlers() { if (!m_exceptionChecksWithCallFrameRollback.empty()) { m_exceptionChecksWithCallFrameRollback.link(this); copyCalleeSavesToVMCalleeSavesBuffer(); // lookupExceptionHandlerFromCallerFrame is passed two arguments, the VM and the exec (the CallFrame*). move(TrustedImmPtr(vm()), GPRInfo::argumentGPR0); move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1); addPtr(TrustedImm32(m_graph.stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, stackPointerRegister); #if CPU(X86) // FIXME: should use the call abstraction, but this is currently in the SpeculativeJIT layer! poke(GPRInfo::argumentGPR0); poke(GPRInfo::argumentGPR1, 1); #endif m_calls.append(CallLinkRecord(call(), lookupExceptionHandlerFromCallerFrame)); jumpToExceptionHandler(); } if (!m_exceptionChecks.empty()) { m_exceptionChecks.link(this); copyCalleeSavesToVMCalleeSavesBuffer(); // lookupExceptionHandler is passed two arguments, the VM and the exec (the CallFrame*). move(TrustedImmPtr(vm()), GPRInfo::argumentGPR0); move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1); #if CPU(X86) // FIXME: should use the call abstraction, but this is currently in the SpeculativeJIT layer! poke(GPRInfo::argumentGPR0); poke(GPRInfo::argumentGPR1, 1); #endif m_calls.append(CallLinkRecord(call(), lookupExceptionHandler)); jumpToExceptionHandler(); } }
void JITCompiler::compileExceptionHandlers() { if (m_exceptionChecks.empty()) return; m_exceptionChecks.link(this); // lookupExceptionHandler is passed one argument, the exec (the CallFrame*). move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); #if CPU(X86) // FIXME: should use the call abstraction, but this is currently in the SpeculativeJIT layer! poke(GPRInfo::argumentGPR0); #endif m_calls.append(CallLinkRecord(call(), lookupExceptionHandler)); // lookupExceptionHandler leaves the handler CallFrame* in the returnValueGPR, // and the address of the handler in returnValueGPR2. jump(GPRInfo::returnValueGPR2); }