Title: [148989] trunk/Source/_javascript_Core
Revision
148989
Author
[email protected]
Date
2013-04-23 13:54:34 -0700 (Tue, 23 Apr 2013)

Log Message

Simplify the baseline JIT loop hint call site.
https://bugs.webkit.org/show_bug.cgi?id=115052.

Reviewed by Geoffrey Garen.

Moved the watchdog timer check after the JIT optimization check. This
ensures that the JIT opimization counter is incremented on every loop
hint even if the watchdog timer fires.

Removed the code that allows the JIT OSR to happen if the watchdog
timer fires but does not result in a termination. It is extremely rare
that the JIT optimization counter would trigger an OSR on the same pass
as when the watchdog timer fire. If it does happen, we'll simply hold
off on servicing the watchdog timer until the next pass (because it's
not time critical).

* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_loop_hint):
(JSC::JIT::emitSlow_op_loop_hint):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (148988 => 148989)


--- trunk/Source/_javascript_Core/ChangeLog	2013-04-23 20:51:42 UTC (rev 148988)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-04-23 20:54:34 UTC (rev 148989)
@@ -1,3 +1,25 @@
+2013-04-23  Mark Lam  <[email protected]>
+
+        Simplify the baseline JIT loop hint call site.
+        https://bugs.webkit.org/show_bug.cgi?id=115052.
+
+        Reviewed by Geoffrey Garen.
+
+        Moved the watchdog timer check after the JIT optimization check. This
+        ensures that the JIT opimization counter is incremented on every loop
+        hint even if the watchdog timer fires.
+
+        Removed the code that allows the JIT OSR to happen if the watchdog
+        timer fires but does not result in a termination. It is extremely rare
+        that the JIT optimization counter would trigger an OSR on the same pass
+        as when the watchdog timer fire. If it does happen, we'll simply hold
+        off on servicing the watchdog timer until the next pass (because it's
+        not time critical).
+
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_loop_hint):
+        (JSC::JIT::emitSlow_op_loop_hint):
+
 2013-04-23  Roger Fong  <[email protected]>
 
         AppleWin build fix.
@@ -104,6 +126,13 @@
 
         Reviewed by Oliver Hunt.
 
+        Edit: The PositiveOrZero condition is added because it is needed for
+        the JIT optimization check. Previously, the JIT check branches around
+        the slow path if the test result is 'Signed' i.e. negative. Since we
+        now need to test for a condition that branches to the slow path (not
+        around it), we need the complement of 'Signed / Negative' i.e. Positive
+        or zero.
+
         SH4 parts contributed by Julien Brianceau.
 
         * assembler/ARMAssembler.h:

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (148988 => 148989)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-04-23 20:51:42 UTC (rev 148988)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-04-23 20:54:34 UTC (rev 148989)
@@ -1279,37 +1279,19 @@
 
 void JIT::emit_op_loop_hint(Instruction*)
 {
-    // Emit the watchdog timer check:
-    if (m_vm->watchdog.isEnabled())
-        addSlowCase(branchTest8(NonZero, AbsoluteAddress(m_vm->watchdog.timerDidFireAddress())));
-
     // Emit the JIT optimization check: 
     if (canBeOptimized())
         addSlowCase(branchAdd32(PositiveOrZero, TrustedImm32(Options::executionCounterIncrementForLoop()),
             AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter())));
+
+    // Emit the watchdog timer check:
+    if (m_vm->watchdog.isEnabled())
+        addSlowCase(branchTest8(NonZero, AbsoluteAddress(m_vm->watchdog.timerDidFireAddress())));
 }
 
 void JIT::emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator& iter)
 {
-    // Emit the slow path of the watchdog timer check:
-    if (m_vm->watchdog.isEnabled()) {
-        linkSlowCase(iter);
-
-        JITStubCall stubCall(this, cti_handle_watchdog_timer);
-        stubCall.call();
-
 #if ENABLE(DFG_JIT)
-        if (canBeOptimized()) {
-            Jump doOptimize = branchAdd32(PositiveOrZero, TrustedImm32(Options::executionCounterIncrementForLoop()),
-                AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter()));
-            emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
-            doOptimize.link(this);
-        } else
-#endif
-            emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
-    }
-
-#if ENABLE(DFG_JIT)
     // Emit the slow path for the JIT optimization check:
     if (canBeOptimized()) {
         linkSlowCase(iter);
@@ -1321,6 +1303,17 @@
         emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
     }
 #endif
+
+    // Emit the slow path of the watchdog timer check:
+    if (m_vm->watchdog.isEnabled()) {
+        linkSlowCase(iter);
+
+        JITStubCall stubCall(this, cti_handle_watchdog_timer);
+        stubCall.call();
+
+        emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
+    }
+
 }
 
 void JIT::emit_resolve_operations(ResolveOperations* resolveOperations, const int* baseVR, const int* valueVR)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to