Debian Codegraph @

js/src/jit-test/tests/gc/bug-1490042.js

raw
1 // |jit-test| --no-ion; --no-baseline; --no-blinterp; skip-if: !('gcstate' in this && hasFunction.oomAfterAllocations)
2
3 gczeal(0);
4
5 // Create a bunch of ObjectGroups with TypeNewScript attached.
6 const count = 1000;
7 let c = [];
8 let a = [];
9 for (let i = 0; i < count; i++) {
10 c[i] = function() { this.a = 1; this.b = 0; this.c = 2; };
11 a[i] = new c[i];
12 }
13
14 // Start an incremental GC and run until we're about to sweep objects.
15 assertEq(gcstate(), "NotActive");
16 gczeal(21);
17 startgc(1);
18
19 // Run incremental slices with simulated OOM set up to provoke OOM when sweeping
20 // types.
21 assertEq(gcstate(), "Sweep");
22 gczeal(10);
23 unsetgczeal(20);
24 while (gcstate() == "Sweep") {
25 oomAfterAllocations(2);
26 gcslice(1);
27 resetOOMFailure();
28 }
29
30 // Ensure our type information stays alive.
31 let x = c.length + a.length;