summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/timeout/interrupt-multi-instance-activation.js
blob: 05ac7ff51a7103f0a5849e8dab8e0624280a27db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// |jit-test| exitstatus: 6; skip-if: !wasmIsSupported()

const {Module, Instance} = WebAssembly;

const {innerWasm} = new Instance(new Module(wasmTextToBinary(`(module
    (func (export "innerWasm") (result i32)
        (local i32)
        (loop $top
            (local.set 0 (i32.add (local.get 0) (i32.const 1)))
            (br_if $top (i32.lt_u (local.get 0) (i32.const 100000)))
        )
        (local.get 0)
    )
)`))).exports;

function middleJS() {
    innerWasm();
}

const {outerWasm} = new Instance(new Module(wasmTextToBinary(`(module
    (func $middleJS (import "" "middleJS"))
    (func (export "outerWasm") (call $middleJS))
)`)), {'':{middleJS}}).exports;

timeout(1);
while (true) {
    outerWasm();
}