summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/profiler/wasm-to-js-1.js
blob: 2ce48f391c97cc878665e06afc670a1551f3dffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// |jit-test| skip-if: !wasmIsSupported(); --fast-warmup
function sample() {
    enableGeckoProfiling();
    readGeckoProfilingStack();
    disableGeckoProfiling();
}
const text = `(module
    (import "m" "f" (func $f))
    (func (export "test")
    (call $f)
))`;
const bytes = wasmTextToBinary(text);
const mod = new WebAssembly.Module(bytes);
const imports = {"m": {"f": sample}};
const instance = new WebAssembly.Instance(mod, imports);
sample();
for (let i = 0; i < 5; i++) {
    gc(this, "shrinking");
    instance.exports.test();
}