Commit c3101eb3 authored by msaboff@apple.com's avatar msaboff@apple.com

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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3886a9b6
2013-12-05 Michael Saboff <msaboff@apple.com>
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):
2013-12-04 Oliver Hunt <oliver@apple.com>
Refactor static getter function prototype to include thisValue in addition to the base object
......
......@@ -1574,10 +1574,7 @@ public:
{
// genericUnwind() leaves the handler CallFrame* in vm->callFrameForThrow,
// and the address of the handler in vm->targetMachinePCForThrow.
// The exception handler expects the CallFrame* in regT0.
move(TrustedImmPtr(vm()), GPRInfo::regT0);
loadPtr(Address(GPRInfo::regT0, VM::targetMachinePCForThrowOffset()), GPRInfo::regT1);
loadPtr(Address(GPRInfo::regT0, VM::callFrameForThrowOffset()), GPRInfo::regT0);
loadPtr(&vm()->targetMachinePCForThrow, GPRInfo::regT1);
jump(GPRInfo::regT1);
}
};
......
......@@ -648,8 +648,8 @@ void JIT::emit_op_push_name_scope(Instruction* currentInstruction)
void JIT::emit_op_catch(Instruction* currentInstruction)
{
move(regT0, callFrameRegister);
move(TrustedImmPtr(m_vm), regT3);
load64(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
load64(Address(regT3, VM::exceptionOffset()), regT0);
store64(TrustedImm64(JSValue::encode(JSValue())), Address(regT3, VM::exceptionOffset()));
emitPutVirtualRegister(currentInstruction[1].u.operand);
......
......@@ -924,11 +924,10 @@ void JIT::emit_op_push_name_scope(Instruction* currentInstruction)
void JIT::emit_op_catch(Instruction* currentInstruction)
{
move(TrustedImmPtr(m_vm), regT3);
// operationThrow returns the callFrame for the handler.
move(regT0, callFrameRegister);
load32(Address(regT3, VM::callFrameForThrowOffset()), callFrameRegister);
// Now store the exception returned by operationThrow.
move(TrustedImmPtr(m_vm), regT3);
load32(Address(regT3, VM::exceptionOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);
load32(Address(regT3, VM::exceptionOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);
store32(TrustedImm32(JSValue().payload()), Address(regT3, VM::exceptionOffset() + OBJECT_OFFSETOF(JSValue, u.asBits.payload)));
......
......@@ -1980,12 +1980,11 @@ _llint_op_catch:
# This is where we end up from the JIT's throw trampoline (because the
# machine code return address will be set to _llint_op_catch), and from
# the interpreter's throw trampoline (see _llint_throw_trampoline).
# The JIT throwing protocol calls for the cfr to be in t0. The throwing
# code must have known that we were throwing to the interpreter, and have
# set VM::targetInterpreterPCForThrow.
move t0, cfr
# The throwing code must have known that we were throwing to the interpreter,
# and have set VM::targetInterpreterPCForThrow.
loadp CodeBlock[cfr], t3
loadp CodeBlock::m_vm[t3], t3
loadp VM::callFrameForThrow[t3], cfr
loadi VM::targetInterpreterPCForThrow[t3], PC
loadi VM::m_exception + PayloadOffset[t3], t0
loadi VM::m_exception + TagOffset[t3], t1
......@@ -2050,8 +2049,6 @@ _llint_throw_from_slow_path_trampoline:
# This essentially emulates the JIT's throwing protocol.
loadp CodeBlock[cfr], t1
loadp CodeBlock::m_vm[t1], t1
loadp VM::topCallFrame[t1], cfr
loadp VM::callFrameForThrow[t1], t0
jmp VM::targetMachinePCForThrow[t1]
......
......@@ -1783,14 +1783,13 @@ _llint_op_catch:
# This is where we end up from the JIT's throw trampoline (because the
# machine code return address will be set to _llint_op_catch), and from
# the interpreter's throw trampoline (see _llint_throw_trampoline).
# The JIT throwing protocol calls for the cfr to be in t0. The throwing
# code must have known that we were throwing to the interpreter, and have
# set VM::targetInterpreterPCForThrow.
move t0, cfr
loadp CodeBlock[cfr], PB
loadp CodeBlock::m_instructions[PB], PB
# The throwing code must have known that we were throwing to the interpreter,
# and have set VM::targetInterpreterPCForThrow.
loadp CodeBlock[cfr], t3
loadp CodeBlock::m_vm[t3], t3
loadp VM::callFrameForThrow[t3], cfr
loadp CodeBlock[cfr], PB
loadp CodeBlock::m_instructions[PB], PB
loadp VM::targetInterpreterPCForThrow[t3], PC
subp PB, PC
rshiftp 3, PC
......@@ -1819,8 +1818,6 @@ _llint_throw_from_slow_path_trampoline:
# This essentially emulates the JIT's throwing protocol.
loadp CodeBlock[cfr], t1
loadp CodeBlock::m_vm[t1], t1
loadp VM::topCallFrame[t1], cfr
loadp VM::callFrameForThrow[t1], t0
jmp VM::targetMachinePCForThrow[t1]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment