Push fix for 543565 for alpha.
authorBrendan Eich <brendan@mozilla.org>
Thu, 04 Feb 2010 17:35:20 -0800
changeset 37915 747a088e53606322d4bceb98e04eeb564c0c0315
parent 37914 b6f7a0dbbfeff4c22eadd367f5254b86bfd84053
child 37916 133af1b882823ead8196ce62ad310471695ee588
push id11495
push userbrendan@mozilla.com
push dateFri, 05 Feb 2010 01:35:30 +0000
treeherdermozilla-central@747a088e5360 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs543565
milestone1.9.3a1pre
Push fix for 543565 for alpha.
js/src/jsopcode.cpp
js/src/trace-test/tests/closures/bug543565.js
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -5578,18 +5578,24 @@ ReconstructPCStack(JSContext *cx, JSScri
                  * Ok, target lies in E. Manually pop C off the model stack,
                  * since we have moved beyond the IFEQ now.
                  */
                 LOCAL_ASSERT(pcdepth != 0);
                 --pcdepth;
             }
         }
 
-        if (sn && SN_TYPE(sn) == SRC_HIDDEN)
+        /*
+         * Ignore early-exit code, which is SRC_HIDDEN, but do not ignore the
+         * hidden POP that sometimes appears after an UNBRAND. See bug 543565.
+         */
+        if (sn && SN_TYPE(sn) == SRC_HIDDEN &&
+            (op != JSOP_POP || js_GetOpcode(cx, script, pc - 1) != JSOP_UNBRAND)) {
             continue;
+        }
 
         if (SimulateOp(cx, script, op, cs, pc, pcstack, pcdepth) < 0)
             return -1;
 
     }
     LOCAL_ASSERT(pc == target);
     return pcdepth;
 
new file mode 100644
--- /dev/null
+++ b/js/src/trace-test/tests/closures/bug543565.js
@@ -0,0 +1,7 @@
+function C() {
+    var k = 3;
+    this.x = function () { return k; };
+    for (var i = 0; i < 9; i++)
+        ;
+}
+new C;