Bug 666292 - The decompiler does not deserve to use FrameRegsIter (it temporarily clobbers script->code) (r=waldo)
authorLuke Wagner <luke@mozilla.com>
Thu, 23 Jun 2011 16:41:59 -0700
changeset 72373 47c6a7fd1af5d7e2193824c2a469780501595e57
parent 72372 57f6c41c843101a3c2b7b6552e5c2026e3fe6ab9
child 72374 dffbbad91d9ff58a3e04a879438a9f627db98a5d
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs666292
milestone7.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 666292 - The decompiler does not deserve to use FrameRegsIter (it temporarily clobbers script->code) (r=waldo)
js/src/jit-test/tests/basic/testBug666292.js
js/src/jsopcode.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testBug666292.js
@@ -0,0 +1,14 @@
+// |jit-test| debug
+
+function f(){
+  this.zzz.zzz;
+  for(let d in []);
+}
+trap(f, 18, '')
+try {
+    f()
+} catch(e) {
+    caught = true;
+    assertEq(""+e, "TypeError: this.zzz is undefined");
+}
+assertEq(caught, true);
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -2085,21 +2085,19 @@ Decompile(SprintStack *ss, jsbytecode *p
         token = CodeToken[op];
 
         if (pc + oplen == jp->dvgfence) {
             /*
              * Rewrite non-get ops to their "get" format if the error is in
              * the bytecode at pc, so we don't decompile more than the error
              * expression.
              */
-            FrameRegsIter iter(cx);
-            while (!iter.done() && !iter.fp()->isScriptFrame())
-                ++iter;
+            StackFrame *fp = js_GetScriptedCaller(cx, NULL);
             uint32 format = cs->format;
-            if (((!iter.done() && pc == iter.pc()) ||
+            if (((fp && pc == fp->pcQuadratic(cx)) ||
                  (pc == startpc && nuses != 0)) &&
                 format & (JOF_SET|JOF_DEL|JOF_INCDEC|JOF_FOR|JOF_VARPROP)) {
                 uint32 mode = JOF_MODE(format);
                 if (mode == JOF_NAME) {
                     /*
                      * JOF_NAME does not imply JOF_ATOM, so we must check for
                      * the QARG and QVAR format types, and translate those to
                      * JSOP_GETARG or JSOP_GETLOCAL appropriately, instead of