summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/wasm-11.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/wasm-11.js')
-rw-r--r--js/src/jit-test/tests/debug/wasm-11.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/wasm-11.js b/js/src/jit-test/tests/debug/wasm-11.js
new file mode 100644
index 0000000000..6fd073c0d2
--- /dev/null
+++ b/js/src/jit-test/tests/debug/wasm-11.js
@@ -0,0 +1,33 @@
+// |jit-test| test-also=--wasm-compiler=optimizing; skip-if: !wasmDebuggingEnabled()
+
+// Test single-stepping where the TLS register can be evicted by a non-trivial
+// function body.
+
+var g = newGlobal({newCompartment: true});
+g.parent = this;
+g.eval(`
+ var dbg = new Debugger(parent);
+`);
+
+var i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`
+ (module
+ (func (export "f2")
+ i64.const 0
+ i64.const 0
+ i32.const 0
+ select
+ drop
+ )
+ )
+`)));
+
+g.eval(`
+ var calledOnStep = 0;
+ dbg.onEnterFrame = frame => {
+ if (frame.type === "wasmcall")
+ frame.onStep = () => { calledOnStep++ }
+ };
+`);
+
+i.exports.f2();
+assertEq(g.calledOnStep, 2);