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/debug/wasm-get-return.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/debug/wasm-get-return.js')
-rw-r--r-- | js/src/jit-test/tests/debug/wasm-get-return.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/wasm-get-return.js b/js/src/jit-test/tests/debug/wasm-get-return.js new file mode 100644 index 0000000000..233d8cf5da --- /dev/null +++ b/js/src/jit-test/tests/debug/wasm-get-return.js @@ -0,0 +1,62 @@ +// |jit-test| test-also=--wasm-compiler=optimizing; skip-if: !wasmDebuggingEnabled() +// Tests that wasm frame opPop event can access function resumption value. + +load(libdir + "wasm.js"); +load(libdir + 'eqArrayHelper.js'); + +function monitorFrameOnPopReturns(wast, expected) { + var values = []; + wasmRunWithDebugger( + wast, + undefined, + function ({dbg}) { + dbg.onEnterFrame = function (frame) { + if (frame.type != 'wasmcall') return; + frame.onPop = function (value) { + values.push(value.return); + }; + }; + }, + function ({error}) { + assertEq(error, undefined); + } + ); + assertEqArray(values, expected); +} + +monitorFrameOnPopReturns( + `(module (func (export "test")))`, + [undefined]); +monitorFrameOnPopReturns( + `(module (func (export "test") (result i32) (i32.const 42)))`, + [42]); +monitorFrameOnPopReturns( + `(module (func (export "test") (result f32) (f32.const 0.5)))`, + [0.5]); +monitorFrameOnPopReturns( + `(module (func (export "test") (result f64) (f64.const -42.75)))`, + [-42.75]); +monitorFrameOnPopReturns( + `(module (func (result i64) (i64.const 2)) (func (export "test") (call 0) (drop)))`, + [2, undefined]); + +// Checking if throwing frame has right resumption value. +var throwCount = 0; +wasmRunWithDebugger( + '(module (func (unreachable)) (func (export "test") (result i32) (call 0) (i32.const 1)))', + undefined, + function ({dbg, g}) { + dbg.onEnterFrame = function (frame) { + if (frame.type != 'wasmcall') return; + frame.onPop = function (value) { + if ('throw' in value) + throwCount++; + }; + }; + }, + function ({error}) { + assertEq(error != undefined, true); + assertEq(throwCount, 2); + } +); + |