diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/debug/wasm-jseval.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/src/jit-test/tests/debug/wasm-jseval.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/wasm-jseval.js b/js/src/jit-test/tests/debug/wasm-jseval.js new file mode 100644 index 0000000000..9b23d9ac6c --- /dev/null +++ b/js/src/jit-test/tests/debug/wasm-jseval.js @@ -0,0 +1,53 @@ +// |jit-test| skip-if: !wasmDebuggingEnabled() +// Tests that JS can be evaluated on wasm module scripts frames. + +load(libdir + "wasm.js"); + +wasmRunWithDebugger( + '(module (memory 1 1)\ + (global (mut f64) (f64.const 0.5))\ + (global f32 (f32.const 3.5))\ + (func (param i32) (local f64) \ + nop \ + f64.const 1.0 \ + local.tee 1 \ + global.set 0 \ + nop) \ + (export "test" (func 0))\ + (data (i32.const 0) "Abc\\x2A"))', + undefined, + function ({dbg}) { + dbg.onEnterFrame = function (frame) { + if (frame.type != 'wasmcall') return; + + var memoryContent = frame.eval('new DataView(memory0.buffer).getUint8(3)').return; + assertEq(memoryContent, 42, 'valid memory content is expected (0x2A)'); + + var global1AndParamSum = frame.eval('global1 + var0').return; + assertEq(global1AndParamSum, 3.5); + + var stepNumber = 0; + frame.onStep = function () { + switch (stepNumber) { + case 0: // before nop + assertEq(frame.offset, 65); + assertEq(frame.eval('global0').return, 0.5); + assertEq(frame.eval('var1').return, 0.0); + break; + case 2: // after local.tee $var1 + assertEq(frame.offset, 79); + assertEq(frame.eval('var1').return, 1.0); + break; + case 3: // after global.set $global0 + assertEq(frame.offset, 80); + assertEq(frame.eval('global0').return, 1.0); + break; + } + stepNumber++; + }; + }; + }, + function ({error}) { + assertEq(error, undefined); + } +); |