Source code

Revision control

Copy as Markdown

Other Tools

// |jit-test| --no-ion; --no-baseline; --no-blinterp; skip-if: !('gcstate' in this && hasFunction.oomAfterAllocations)
gczeal(0);
// Create a bunch of ObjectGroups with TypeNewScript attached.
const count = 1000;
let c = [];
let a = [];
for (let i = 0; i < count; i++) {
c[i] = function() { this.a = 1; this.b = 0; this.c = 2; };
a[i] = new c[i];
}
// Start an incremental GC and run until we're about to sweep objects.
assertEq(gcstate(), "NotActive");
gczeal(21);
startgc(1);
// Run incremental slices with simulated OOM set up to provoke OOM when sweeping
// types.
assertEq(gcstate(), "Sweep");
gczeal(10);
unsetgczeal(20);
while (gcstate() == "Sweep") {
oomAfterAllocations(2);
gcslice(1);
resetOOMFailure();
}
// Ensure our type information stays alive.
let x = c.length + a.length;