Debian Codegraph @

js/src/jit-test/tests/wasm/timeout/2.js

raw
1 // |jit-test| exitstatus: 6; skip-if: !wasmIsSupported()
2
3 // Don't include wasm.js in timeout tests: when wasm isn't supported, it will
4 // quit(0) which will cause the test to fail.
5
6 var tbl = new WebAssembly.Table({initial:1, element:"anyfunc"});
7
8 new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`(module
9 (import "imports" "tbl" (table 1 funcref))
10 (func $iloop
11 loop $top
12 br $top
13 end
14 )
15 (elem (i32.const 0) $iloop)
16 )`)), {imports:{tbl}});
17
18 var outer = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`(module
19 (import "imports" "tbl" (table 1 funcref))
20 (type $v2v (func))
21 (func (export "run")
22 i32.const 0
23 call_indirect (type $v2v)
24 )
25 )`)), {imports:{tbl}});
26
27 setJitCompilerOption('simulator.always-interrupt', 1);
28 timeout(1, () => { tbl.set(0, null); gc() });
29 outer.exports.run();
30 assertEq(true, false);