Bug 825966 part 2 - Mark JSOP_CASE/JSOP_DEFAULT targets as safepoint. r=bhackett
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 03 Jan 2013 18:35:54 +0100
changeset 126558 ae47afdbb7d144d22a381db0f3cad67bb9fba3a3
parent 126557 a5b2384539cd8fada80bfa3a2454df250c5164d0
child 126559 c0e7cc40f35648eb8c07a8b4354734a7142a3a34
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs825966
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 825966 part 2 - Mark JSOP_CASE/JSOP_DEFAULT targets as safepoint. r=bhackett
js/src/jit-test/tests/jaeger/bug825966.js
js/src/jsanalyze.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug825966.js
@@ -0,0 +1,18 @@
+datediff = function(date1, date2, interval) {
+    var delta = 1;
+    switch(interval) {
+      case "day":
+	delta /= 24;
+      case "minute":
+	delta /= 60;
+      case Math:
+	break;
+    }
+    return delta;
+};
+
+var diff = datediff(new Date("2012-04-28T14:30:00Z"), new Date("2012-04-29T14:30:00Z"), "day");
+for (var i = 0; i < 50; i++) {
+    diff = datediff(new Date("2012-04-28T17:00:00Z"), new Date("2012-04-28T17:30:00Z"), "minute");
+    assertEq(diff, 1/60);
+}
--- a/js/src/jsanalyze.cpp
+++ b/js/src/jsanalyze.cpp
@@ -595,31 +595,27 @@ ScriptAnalysis::analyzeBytecode(JSContex
             }
             break;
         }
 
         bool jump = IsJumpOpcode(op);
 
         /* Check basic jump opcodes, which may or may not have a fallthrough. */
         if (jump) {
-            /* Some opcodes behave differently on their branching path. */
+            /* Case instructions do not push the lvalue back when branching. */
             unsigned newStackDepth = stackDepth;
-
-            switch (op) {
-              case JSOP_CASE:
-                /* Case instructions do not push the lvalue back when branching. */
+            if (op == JSOP_CASE)
                 newStackDepth--;
-                break;
-
-              default:;
-            }
 
             unsigned targetOffset = offset + GET_JUMP_OFFSET(pc);
             if (!addJump(cx, targetOffset, &nextOffset, &forwardJump, &forwardLoop, newStackDepth))
                 return;
+
+            if (op == JSOP_CASE || op == JSOP_DEFAULT)
+                getCode(targetOffset).safePoint = true;
         }
 
         /* Handle any fallthrough from this opcode. */
         if (!BytecodeNoFallThrough(op)) {
             JS_ASSERT(successorOffset < script_->length);
 
             Bytecode *&nextcode = codeArray[successorOffset];