diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 6d25cdf47b87..476ee70b9477 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -5583,8 +5583,14 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target, } } - 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; diff --git a/js/src/trace-test/tests/closures/bug543565.js b/js/src/trace-test/tests/closures/bug543565.js new file mode 100644 index 000000000000..828688b3a8f7 --- /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;