Bug 1455612: Skip wasm frames in updatePcQuadratic; r=jandem
authorBenjamin Bouvier <benj@benj.me>
Mon, 23 Apr 2018 16:03:30 +0200
changeset 471700 84ac907189ef656dc996789e3319cb6acb05d518
parent 471699 24893a95845db11f6fcd5761880d5b4263f060be
child 471701 a1ea9ba622e615e1cb262894d1f8b9ee581ae43e
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1455612
milestone61.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 1455612: Skip wasm frames in updatePcQuadratic; r=jandem
js/src/jit-test/tests/wasm/regress/jit-updatepcquad.js
js/src/vm/Stack.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/regress/jit-updatepcquad.js
@@ -0,0 +1,31 @@
+var evalInFrame = (function (global) {
+    var dbgGlobal = newGlobal();
+    var dbg = new dbgGlobal.Debugger();
+    return function evalInFrame(code) {
+        dbg.addDebuggee(global);
+        var frame = dbg.getNewestFrame().older;
+        frame = frame.older || frame;
+        let completion = frame.eval(code);
+        return completion.return;
+    };
+})(this);
+
+const { exports } = wasmEvalText(`
+    (module
+        (import "global" "func" (param i32) (result i32))
+        (func (export "func_0") (param i32)(result i32)
+         get_local 0
+         call 0
+        )
+    )
+`, {
+    global: {
+        func: function jscode(i) {
+            return evalInFrame(`a = ${i}`);
+        }
+    }
+});
+
+for (i = 0; i < 20; ++i) {
+    assertEq(exports.func_0(i), i);
+}
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -1141,18 +1141,22 @@ FrameIter::updatePcQuadratic()
             // activation's exitFP may be invalid, so create a new
             // activation iterator.
             data_.activations_ = ActivationIterator(data_.cx_);
             while (data_.activations_.activation() != activation)
                 ++data_.activations_;
 
             // Look for the current frame.
             data_.jitFrames_ = JitFrameIter(data_.activations_->asJit());
-            while (!jsJitFrame().isBaselineJS() || jsJitFrame().baselineFrame() != frame)
+            while (!isJSJit() ||
+                   !jsJitFrame().isBaselineJS() ||
+                   jsJitFrame().baselineFrame() != frame)
+            {
                 ++data_.jitFrames_;
+            }
 
             // Update the pc.
             MOZ_ASSERT(jsJitFrame().baselineFrame() == frame);
             jsJitFrame().baselineScriptAndPc(nullptr, &data_.pc_);
             return;
         }
         break;
     }