Revert "Bug 797496 - Ignore hidden PC even with try notes. r=luke"
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Thu, 04 Oct 2012 12:35:03 -0700
changeset 115573 66b4f2ea351d297c57e424ba6c5dfc03f19807d2
parent 115572 3b7a134bc3aa544ef8e508f6b599fc4eef6a68ec
child 115574 0fdefdb3481df9214851338cfc6c47ca9fa635d9
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersluke
bugs797496
milestone18.0a1
Revert "Bug 797496 - Ignore hidden PC even with try notes. r=luke" This reverts changeset 3b7a134bc3aa.
js/src/jit-test/tests/basic/bug797496.js
js/src/jsopcode.cpp
deleted file mode 100644
--- a/js/src/jit-test/tests/basic/bug797496.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// |jit-test| error: TypeError
-var set = Set(['a']);
-var n = 5;
-for (let v of set) {
-    if (n === 0)
-        break;
-    let g = set(Set(0xffffffff, n), 1);
-}
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -6431,49 +6431,49 @@ ReconstructPCStack(JSContext *cx, JSScri
                 /* Use the Hidden pc count if we follow the goto */
                 if (hpcdepth != unsigned(-1)) {
                     pcdepth = hpcdepth;
                     hpcdepth = unsigned(-1);
                 }
                 continue;
             }
 
+            if (!script->hasTrynotes()) {
+                /* Use the normal pc count if continue after the goto */
+                hpcdepth = unsigned(-1);
+                continue;
+            }
+
             /*
              * If we do not follow a goto we look for another mean to continue
              * at the next PC.
              */
-            if (script->hasTrynotes()) {
-                JSTryNote *tn = script->trynotes()->vector;
-                JSTryNote *tnEnd = tn + script->trynotes()->length;
-                for (; tn != tnEnd; tn++) {
-                    jsbytecode *start = script->main() + tn->start;
-                    jsbytecode *end = start + tn->length;
-                    if (start < pc && pc <= end && end <= target)
-                        break;
-                }
-
-                if (tn != tnEnd) {
-                    pcdepth = tn->stackDepth;
-                    hpcdepth = unsigned(-1);
-                    oplen = 0;
-                    pc = script->main() + tn->start + tn->length;
-                    continue;
-                }
+            JSTryNote *tn = script->trynotes()->vector;
+            JSTryNote *tnEnd = tn + script->trynotes()->length;
+            for (; tn != tnEnd; tn++) {
+                jsbytecode *start = script->main() + tn->start;
+                jsbytecode *end = start + tn->length;
+                if (start < pc && pc <= end && end <= target)
+                    break;
+            }
+
+            if (tn != tnEnd) {
+                pcdepth = tn->stackDepth;
+                hpcdepth = unsigned(-1);
+                oplen = 0;
+                pc = script->main() + tn->start + tn->length;
+                continue;
             }
 
             /*
              * JSOP_THROWING compensates for hidden JSOP_DUP at the start of the
              * previous guarded catch (see EmitTry in BytecodeEmitter.cpp).
              */
             if (JSOp(*(pc + oplen)) == JSOP_THROWING)
                 hpcdepth = pcdepth + 2;
-            else
-                /* Use the normal pc count if continue after the goto */
-                hpcdepth = unsigned(-1);
-
             continue;
         }
 
         /*
          * A (C ? T : E) expression requires skipping either T (if target is in
          * E) or both T and E (if target is after the whole expression) before
          * adjusting pcdepth based on the JSOP_IFEQ at pc that tests condition
          * C. We know that the stack depth can't change from what it was with