Debian Codegraph @

js/src/jit-test/tests/profiler/wasm-to-js-2.js

raw
1 // |jit-test| skip-if: !wasmIsSupported()
2 // Ensure readGeckoProfilingStack finds at least 1 Wasm frame on the stack.
3 function calledFromWasm() {
4 let frames = readGeckoProfilingStack().flat();
5 assertEq(frames.filter(f => f.kind === "wasm").length >= 1, true);
6 }
7 enableGeckoProfiling();
8 const text = `(module
9 (import "m" "f" (func $f))
10 (func (export "test")
11 (call $f)
12 ))`;
13 const bytes = wasmTextToBinary(text);
14 const mod = new WebAssembly.Module(bytes);
15 const imports = {"m": {"f": calledFromWasm}};
16 const instance = new WebAssembly.Instance(mod, imports);
17 for (let i = 0; i < 150; i++) {
18 instance.exports.test();
19 }