Debian Codegraph @

js/src/jit-test/tests/ion/bailout-oom-01.js

raw
1 // |jit-test| --no-threads; --fast-warmup
2
3 setJitCompilerOption("ion.warmup.trigger", 20);
4 gczeal(0);
5
6 var nonce = 0;
7
8 function doTest() {
9 // Block Warp/Ion compile.
10 with ({}) {};
11
12 nonce += 1;
13
14 // Fresh function and script.
15 let fn = new Function("arg", `
16 /* {nonce} */
17 var r1 = [];
18 var r2 = [];
19 return (() => arg + 1)();
20 `);
21
22 // Warm up JITs.
23 for (var i = 0; i < 20; ++i) {
24 assertEq(fn(i), i + 1);
25 }
26
27 // Trigger bailout.
28 fn();
29 }
30
31 // Warmup doTest already.
32 doTest();
33 doTest();
34
35 // OOM test the JIT compilation and bailout.
36 oomTest(doTest);