diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/wasm/tail-calls/litmus17.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/src/jit-test/tests/wasm/tail-calls/litmus17.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/tail-calls/litmus17.js b/js/src/jit-test/tests/wasm/tail-calls/litmus17.js new file mode 100644 index 0000000000..025c025305 --- /dev/null +++ b/js/src/jit-test/tests/wasm/tail-calls/litmus17.js @@ -0,0 +1,27 @@ +// |jit-test| skip-if: !wasmTailCallsEnabled() + +// Test that unwinding will find the right instance in the middle of a tail call +// chain. This test is mostly useful on the simulators, as they will walk the +// stack, looking for the innermost instance, on every memory reference. The +// logic of this test is that the setup intra-module tail call in mod2 will need +// to be recorded as possibly-inter-module because the subsequent inter-module +// call replaces the activation with one that is actually inter-module. + +let ins1 = wasmEvalText(` +(module + (memory (export "mem") 1 1) + (func (export "memref") (result i32) + (i32.load (i32.const 0))))`); + +let ins2 = wasmEvalText(` +(module + (import "mod1" "memref" (func $memref (result i32))) + + (func (export "run") (result i32) + (return_call $g)) + + (func $g (result i32) + (return_call $memref)))`, {mod1: ins1.exports}); + +(new Int32Array(ins1.exports.mem.buffer))[0] = 1337; +assertEq(ins2.exports.run(), 1337); |