Debian Codegraph @

js/src/jit-test/tests/debug/wasm-07.js

raw
1 // |jit-test| test-also=--wasm-compiler=optimizing; skip-if: !wasmDebuggingEnabled()
2
3 // Checking existence of all frame.offset references during onEnterFrame,
4 // onLeaveFrame and onStep events in the source code, and that we can
5 // potentially resolve offset back to the line/column.
6
7 load(libdir + "wasm.js");
8
9 var offsets;
10 wasmRunWithDebugger(
11 '(module (func (nop) (nop)) (export "test" (func 0)))',
12 undefined,
13 function ({dbg}) {
14 offsets = [];
15 dbg.onEnterFrame = function (frame) {
16 if (frame.type != 'wasmcall') {
17 return;
18 }
19 offsets.push(frame.offset);
20 frame.onStep = function () {
21 offsets.push(frame.offset);
22 };
23 frame.onPop = function () {
24 offsets.push(frame.offset);
25 };
26 };
27 },
28 function ({wasmScript, error}) {
29 assertEq(error, undefined);
30 assertEq(offsets.length, 4);
31 offsets.forEach(offset => {
32 var loc = wasmScript.getOffsetLocation(offset);
33 assertEq(loc.isEntryPoint, true);
34 assertEq(loc.lineNumber > 0, true);
35 assertEq(loc.columnNumber > 0, true);
36 assertEq(wasmScript.getLineOffsets(loc.lineNumber).length, 1);
37 });
38 }
39 );