summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/bailout-oom-01.js
blob: 0408f44e98ab699e77f1c997fca5de56116119a7 (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
29
30
31
32
33
34
35
36
// |jit-test| --no-threads; --fast-warmup

setJitCompilerOption("ion.warmup.trigger", 20);
gczeal(0);

var nonce = 0;

function doTest() {
    // Block Warp/Ion compile.
    with ({}) {};

    nonce += 1;

    // Fresh function and script.
    let fn = new Function("arg", `
        /* {nonce} */
        var r1 = [];
        var r2 = [];
        return (() => arg + 1)();
    `);

    // Warm up JITs.
    for (var i = 0; i < 20; ++i) {
        assertEq(fn(i), i + 1);
    }

    // Trigger bailout.
    fn();
}

// Warmup doTest already.
doTest();
doTest();

// OOM test the JIT compilation and bailout.
oomTest(doTest);