Changeset 160573 in webkit


Ignore:
Timestamp:
Dec 13, 2013 4:39:45 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

Fix exception handling for the LLINT.
https://bugs.webkit.org/show_bug.cgi?id=125672.

Reviewed by Geoffrey Garen.

The baseline JIT exception handling is still broken.

  • JavaScriptCore.order:
  • llint/LLIntSlowPaths.cpp:
  • llint/LLIntSlowPaths.h:
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • updated the 32bit file with some of the changes to keep track with the 64bit one though it doesn't build yet. The build failure will clearly tell us some of the things that need to be fixed later.
  • llint/LowLevelInterpreter64.asm:
  • Called restoreStackPointerAfterCall() in op_catch and nativeCallTrampoline to restore the appropriate stack pointer.
  • Renamed the restoreStackPointerAfterJSCall() macro to restoreStackPointerAfterCall because we also need to call it after a call to a native / host function.
  • Removed llint_throw_from_native_call because it no longer does anything useful.
  • Moved call to functionEpilogue() in nativeCallTrampoline before the exception check because we should have returned from the native / host function already.

The Interpreter::unwind() code also relies on this. The VM will unwind and "pop"
JS frames, but will stop at host frames. The host frame should pop itself. Then,
we call Interpreter::unwind() again to continue for caller frames further up
the stack.

  • Removed the check for the sentinel frame in handleUncaughtException because we're guaranteed to be at the frame above the sentinel frame.
Location:
branches/jsCStack/Source/JavaScriptCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/jsCStack/Source/JavaScriptCore/ChangeLog

    r160562 r160573  
     12013-12-13  Mark Lam  <mark.lam@apple.com>
     2
     3        Fix exception handling for the LLINT.
     4        https://bugs.webkit.org/show_bug.cgi?id=125672.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The baseline JIT exception handling is still broken.
     9
     10        * JavaScriptCore.order:
     11        * llint/LLIntSlowPaths.cpp:
     12        * llint/LLIntSlowPaths.h:
     13        * llint/LowLevelInterpreter.asm:
     14        * llint/LowLevelInterpreter32_64.asm:
     15        - updated the 32bit file with some of the changes to keep track with the 64bit
     16          one though it doesn't build yet. The build failure will clearly tell us some of
     17          the things that need to be fixed later.
     18        * llint/LowLevelInterpreter64.asm:
     19        - Called restoreStackPointerAfterCall() in op_catch and nativeCallTrampoline to
     20          restore the appropriate stack pointer.
     21        - Renamed the restoreStackPointerAfterJSCall() macro to restoreStackPointerAfterCall
     22          because we also need to call it after a call to a native / host function.
     23        - Removed llint_throw_from_native_call because it no longer does anything useful.
     24        - Moved call to functionEpilogue() in nativeCallTrampoline before the exception
     25          check because we should have returned from the native / host function already.
     26
     27          The Interpreter::unwind() code also relies on this. The VM will unwind and "pop"
     28          JS frames, but will stop at host frames. The host frame should pop itself. Then,
     29          we call Interpreter::unwind() again to continue for caller frames further up
     30          the stack.
     31
     32        - Removed the check for the sentinel frame in handleUncaughtException because
     33          we're guaranteed to be at the frame above the sentinel frame.
     34
    1352013-12-13  Michael Saboff  <msaboff@apple.com>
    236
  • branches/jsCStack/Source/JavaScriptCore/JavaScriptCore.order

    r159709 r160573  
    49824982_llint_slow_path_profile_will_call
    49834983_llint_slow_path_profile_did_call
    4984 _llint_throw_from_native_call
    49854984_llint_begin
    49864985_llint_program_prologue
  • branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r160253 r160573  
    13081308}
    13091309
    1310 LLINT_SLOW_PATH_DECL(throw_from_native_call)
    1311 {
    1312     LLINT_BEGIN();
    1313     ASSERT(vm.exception());
    1314     LLINT_END();
    1315 }
    1316 
    13171310LLINT_SLOW_PATH_DECL(slow_path_handle_exception)
    13181311{
  • branches/jsCStack/Source/JavaScriptCore/llint/LLIntSlowPaths.h

    r160253 r160573  
    119119LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_profile_will_call);
    120120LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_profile_did_call);
    121 LLINT_SLOW_PATH_HIDDEN_DECL(throw_from_native_call);
    122121LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_handle_exception);
    123122LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_resolve_scope);
  • branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r160527 r160573  
    277277        move calleeFramePtr, sp
    278278        call LLIntCallLinkInfo::machineCodeTarget[callLinkInfo]
    279         restoreStackPointerAfterJSCall()
     279        restoreStackPointerAfterCall()
    280280        dispatchAfterCall()
    281281    end
     
    291291                addp CallerFrameAndPCSize, t1, sp
    292292                call callee
    293                 restoreStackPointerAfterJSCall()
     293                restoreStackPointerAfterCall()
    294294                dispatchAfterCall()
    295295            end
  • branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r160497 r160573  
    344344end
    345345
    346 macro doHandleUncaughtException(extraStackSpace)
    347346_handleUncaughtException:
    348     functionEpilogue(extraStackSpace)
     347    loadp ScopeChain[cfr], t3
     348    andp MarkedBlockMask, t3
     349    loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
     350    loadp VM::callFrameForThrow[t3], cfr
     351
     352    # So far, we've unwound the stack to the frame just below the sentinel frame.
     353    # We need to pop to the sentinel frame and do the necessary clean up for
     354    # returning to the caller C frame.
     355    loadp CallerFrame[cfr], cfr
     356
     357    loadp Callee[cfr], t3 # VM.topCallFrame
     358    loadp ScopeChain[cfr], t6
     359    storep t6, [t3]
     360
     361    callToJavaScriptEpilogue()
    349362    ret
    350 end
    351363
    352364macro doReturnFromHostFunction(extraStackSpace)
     
    21302142        error
    21312143    end
    2132     bineq VM::m_exception + TagOffset[t3], EmptyValueTag, .exception
     2144    bineq VM::m_exception + TagOffset[t3], EmptyValueTag, .handleException
    21332145    ret
    2134 .exception:
     2146
     2147.handleException:
    21352148    preserveReturnAddressAfterCall(t1) # This is really only needed on X86
    2136     loadi ArgumentCount + TagOffset[cfr], PC
    2137     callSlowPath(_llint_throw_from_native_call)
     2149    storep cfr, VM::topCallFrame[t3]
     2150    restoreStackPointerAfterCall()
    21382151    jmp _llint_throw_from_slow_path_trampoline
    21392152end
  • branches/jsCStack/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r160562 r160573  
    142142end
    143143
    144 macro restoreStackPointerAfterJSCall()
     144macro restoreStackPointerAfterCall()
    145145    loadp CodeBlock[cfr], t1
    146146    loadi CodeBlock::m_numCalleeRegisters[t1], t1
     
    281281    loadp VM::callFrameForThrow[t3], cfr
    282282
    283     bpeq CodeBlock[cfr], 1, .calleeFramePopped
     283    # So far, we've unwound the stack to the frame just below the sentinel frame.
     284    # We need to pop to the sentinel frame and do the necessary clean up for
     285    # returning to the caller C frame.
    284286    loadp CallerFrame[cfr], cfr
    285287
    286 .calleeFramePopped:
    287288    loadp Callee[cfr], t3 # VM.topCallFrame
    288289    loadp ScopeChain[cfr], t6
     
    18531854    loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
    18541855    loadp VM::callFrameForThrow[t3], cfr
     1856    restoreStackPointerAfterCall()
     1857
    18551858    loadp CodeBlock[cfr], PB
    18561859    loadp CodeBlock::m_instructions[PB], PB
     
    19571960    end
    19581961
    1959     btqnz VM::m_exception[t3], .exception
    19601962    functionEpilogue()
     1963
     1964    btqnz VM::m_exception[t3], .handleException
    19611965    ret
    1962 .exception:
    1963     if X86_64
    1964         pop t1
    1965     end
    1966     loadi ArgumentCount + TagOffset[cfr], PC
    1967     loadp CodeBlock[cfr], PB
    1968     loadp CodeBlock::m_vm[PB], t0
    1969     loadp CodeBlock::m_instructions[PB], PB
    1970     storep cfr, VM::topCallFrame[t0]
    1971     callSlowPath(_llint_throw_from_native_call)
     1966
     1967.handleException:
     1968    storep cfr, VM::topCallFrame[t3]
     1969    restoreStackPointerAfterCall()
    19721970    jmp _llint_throw_from_slow_path_trampoline
    19731971end
Note: See TracChangeset for help on using the changeset viewer.