Title: [160213] trunk/Source/_javascript_Core
Revision
160213
Author
[email protected]
Date
2013-12-05 21:32:06 -0800 (Thu, 05 Dec 2013)

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (160212 => 160213)


--- trunk/Source/_javascript_Core/ChangeLog	2013-12-06 05:20:32 UTC (rev 160212)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-12-06 05:32:06 UTC (rev 160213)
@@ -1,3 +1,29 @@
+2013-12-05  Michael Saboff  <[email protected]>
+
+        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  <[email protected]>
 
         Refactor static getter function prototype to include thisValue in addition to the base object

Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.h (160212 => 160213)


--- trunk/Source/_javascript_Core/jit/CCallHelpers.h	2013-12-06 05:20:32 UTC (rev 160212)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.h	2013-12-06 05:32:06 UTC (rev 160213)
@@ -1574,10 +1574,7 @@
     {
         // 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);
     }
 };

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (160212 => 160213)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-12-06 05:20:32 UTC (rev 160212)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-12-06 05:32:06 UTC (rev 160213)
@@ -648,8 +648,8 @@
 
 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);

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (160212 => 160213)


--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2013-12-06 05:20:32 UTC (rev 160212)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2013-12-06 05:32:06 UTC (rev 160213)
@@ -924,11 +924,10 @@
 
 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)));

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (160212 => 160213)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2013-12-06 05:20:32 UTC (rev 160212)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2013-12-06 05:32:06 UTC (rev 160213)
@@ -1980,12 +1980,11 @@
     # 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 @@
     # 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]
 
 

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (160212 => 160213)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2013-12-06 05:20:32 UTC (rev 160212)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2013-12-06 05:32:06 UTC (rev 160213)
@@ -1783,14 +1783,13 @@
     # 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 @@
     # 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]
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to