Changeset 160213 in webkit


Ignore:
Timestamp:
Dec 5, 2013 9:32:06 PM (10 years ago)
Author:
msaboff@apple.com
Message:

JSC: Simplify interface between throw and catch handler
https://bugs.webkit.org/show_bug.cgi?id=125328

Reviewed by Geoffrey Garen.

Simplified the throw - catch interface. The throw side is only responsible for
jumping to the appropriate op_catch handler or returnFromJavaScript for uncaught
exceptions. The handler uses the exception values like VM.callFrameForThrow
as appropriate and no longer relies on the throw side putting anything in
registers.

  • jit/CCallHelpers.h:

(JSC::CCallHelpers::jumpToExceptionHandler):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_catch):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_catch):

  • llint/LowLevelInterpreter32_64.asm:

(_llint_op_catch):
(_llint_throw_from_slow_path_trampoline):

  • llint/LowLevelInterpreter64.asm:

(_llint_op_catch):
(_llint_throw_from_slow_path_trampoline):

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r160208 r160213  
     12013-12-05  Michael Saboff  <msaboff@apple.com>
     2
     3        JSC: Simplify interface between throw and catch handler
     4        https://bugs.webkit.org/show_bug.cgi?id=125328
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Simplified the throw - catch interface.  The throw side is only responsible for
     9        jumping to the appropriate op_catch handler or returnFromJavaScript for uncaught
     10        exceptions.  The handler uses the exception values like VM.callFrameForThrow
     11        as appropriate and no longer relies on the throw side putting anything in
     12        registers.
     13
     14        * jit/CCallHelpers.h:
     15        (JSC::CCallHelpers::jumpToExceptionHandler):
     16        * jit/JITOpcodes.cpp:
     17        (JSC::JIT::emit_op_catch):
     18        * jit/JITOpcodes32_64.cpp:
     19        (JSC::JIT::emit_op_catch):
     20        * llint/LowLevelInterpreter32_64.asm:
     21        (_llint_op_catch):
     22        (_llint_throw_from_slow_path_trampoline):
     23        * llint/LowLevelInterpreter64.asm:
     24        (_llint_op_catch):
     25        (_llint_throw_from_slow_path_trampoline):
     26
    1272013-12-04  Oliver Hunt  <oliver@apple.com>
    228
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.h

    r159748 r160213  
    15751575        // genericUnwind() leaves the handler CallFrame* in vm->callFrameForThrow,
    15761576        // and the address of the handler in vm->targetMachinePCForThrow.
    1577         // The exception handler expects the CallFrame* in regT0.
    1578         move(TrustedImmPtr(vm()), GPRInfo::regT0);
    1579         loadPtr(Address(GPRInfo::regT0, VM::targetMachinePCForThrowOffset()), GPRInfo::regT1);
    1580         loadPtr(Address(GPRInfo::regT0, VM::callFrameForThrowOffset()), GPRInfo::regT0);
     1577        loadPtr(&vm()->targetMachinePCForThrow, GPRInfo::regT1);
    15811578        jump(GPRInfo::regT1);
    15821579    }
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r160109 r160213  
    649649void JIT::emit_op_catch(Instruction* currentInstruction)
    650650{
    651     move(regT0, callFrameRegister);
    652651    move(TrustedImmPtr(m_vm), regT3);
     652    load64(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
    653653    load64(Address(regT3, VM::exceptionOffset()), regT0);
    654654    store64(TrustedImm64(JSValue::encode(JSValue())), Address(regT3, VM::exceptionOffset()));
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r160109 r160213  
    925925void JIT::emit_op_catch(Instruction* currentInstruction)
    926926{
     927    move(TrustedImmPtr(m_vm), regT3);
    927928    // operationThrow returns the callFrame for the handler.
    928     move(regT0, callFrameRegister);
    929 
     929    load32(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
    930930    // Now store the exception returned by operationThrow.
    931     move(TrustedImmPtr(m_vm), regT3);
    932931    load32(Address(regT3, VM::exceptionOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);
    933932    load32(Address(regT3, VM::exceptionOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r160109 r160213  
    19811981    # machine code return address will be set to _llint_op_catch), and from
    19821982    # the interpreter's throw trampoline (see _llint_throw_trampoline).
    1983     # The JIT throwing protocol calls for the cfr to be in t0. The throwing
    1984     # code must have known that we were throwing to the interpreter, and have
    1985     # set VM::targetInterpreterPCForThrow.
    1986     move t0, cfr
     1983    # The throwing code must have known that we were throwing to the interpreter,
     1984    # and have set VM::targetInterpreterPCForThrow.
    19871985    loadp CodeBlock[cfr], t3
    19881986    loadp CodeBlock::m_vm[t3], t3
     1987    loadp VM::callFrameForThrow[t3], cfr
    19891988    loadi VM::targetInterpreterPCForThrow[t3], PC
    19901989    loadi VM::m_exception + PayloadOffset[t3], t0
     
    20512050    loadp CodeBlock[cfr], t1
    20522051    loadp CodeBlock::m_vm[t1], t1
    2053     loadp VM::topCallFrame[t1], cfr
    2054     loadp VM::callFrameForThrow[t1], t0
    20552052    jmp VM::targetMachinePCForThrow[t1]
    20562053
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r160109 r160213  
    17841784    # machine code return address will be set to _llint_op_catch), and from
    17851785    # the interpreter's throw trampoline (see _llint_throw_trampoline).
    1786     # The JIT throwing protocol calls for the cfr to be in t0. The throwing
    1787     # code must have known that we were throwing to the interpreter, and have
    1788     # set VM::targetInterpreterPCForThrow.
    1789     move t0, cfr
     1786    # The throwing code must have known that we were throwing to the interpreter,
     1787    # and have set VM::targetInterpreterPCForThrow.
     1788    loadp CodeBlock[cfr], t3
     1789    loadp CodeBlock::m_vm[t3], t3
     1790    loadp VM::callFrameForThrow[t3], cfr
    17901791    loadp CodeBlock[cfr], PB
    17911792    loadp CodeBlock::m_instructions[PB], PB
    1792     loadp CodeBlock[cfr], t3
    1793     loadp CodeBlock::m_vm[t3], t3
    17941793    loadp VM::targetInterpreterPCForThrow[t3], PC
    17951794    subp PB, PC
     
    18201819    loadp CodeBlock[cfr], t1
    18211820    loadp CodeBlock::m_vm[t1], t1
    1822     loadp VM::topCallFrame[t1], cfr
    1823     loadp VM::callFrameForThrow[t1], t0
    18241821    jmp VM::targetMachinePCForThrow[t1]
    18251822
Note: See TracChangeset for help on using the changeset viewer.