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/return-call-profiling.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 'js/src/jit-test/tests/wasm/tail-calls/return-call-profiling.js')
-rw-r--r-- | js/src/jit-test/tests/wasm/tail-calls/return-call-profiling.js | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/tail-calls/return-call-profiling.js b/js/src/jit-test/tests/wasm/tail-calls/return-call-profiling.js new file mode 100644 index 0000000000..2946a16d71 --- /dev/null +++ b/js/src/jit-test/tests/wasm/tail-calls/return-call-profiling.js @@ -0,0 +1,68 @@ +// Tests if the profiler (frame iterator) can unwind in the middle +// of collapse frame instructions. + +enableGeckoProfiling(); +try { + enableSingleStepProfiling(); +} catch (e) { + // continue anyway if single step profiling is not supported +} + +var ins = wasmEvalText(` +(module + (func $f (param i64 i64 i64 i64 i64 i64 i64 i64 i64) + local.get 0 + i64.eqz + br_if 0 + local.get 0 + return_call $g + ) + (func $g (param i64) + local.get 0 + i64.const 1 + i64.sub + i64.const 2 + i64.const 6 + i64.const 3 + i64.const 4 + i64.const 1 + i64.const 2 + i64.const 6 + i64.const 3 + return_call $f + ) + (func (export "run") (param i64) + local.get 0 + call $g + ) +)`); + +for (var i = 0; i < 10; i++) { + ins.exports.run(100n); +} + +// Also when trampoline is used. +var ins0 = wasmEvalText(`(module (func (export "t")))`); +var ins = wasmEvalText(` +(module + (import "" "t" (func $g)) + (func $f (return_call_indirect $t (i32.const 0))) + (table $t 1 1 funcref) + + (func (export "run") (param i64) + loop + local.get 0 + i64.eqz + br_if 1 + call $f + local.get 0 + i64.const 1 + i64.sub + local.set 0 + br 0 + end + ) + (elem (i32.const 0) $g) +)`, {"": {t: ins0.exports.t},}); + +ins.exports.run(10n); |