Debian Codegraph @

js/src/jit-test/tests/gc/pretenure-object-long-then-short-lived.js

raw
1 // Allocate many objects, changing the lifetime from long-lived to short lived
2 // and check that we recover.
3
4 load(libdir + "pretenure.js");
5
6 setupPretenureTest();
7
8 // Phase 1: long lived.
9
10 allocateObjects(nurseryCount, true);
11 let { minor, major } = runTestAndCountCollections(
12 () => allocateObjects(tenuredCount, true)
13 );
14
15 print(`${minor} minor GCs, ${major} major GCs`);
16 assertEq(minor <= 1, true);
17 assertEq(major >= 5, true);
18
19 // Phase 2: short lived.
20
21 allocateObjects(tenuredCount, false);
22 ({ minor, major } = runTestAndCountCollections(
23 () => allocateObjects(nurseryCount * 5, false)
24 ));
25
26 print(`${minor} minor GCs, ${major} major GCs`);
27 assertEq(minor >= 5, true);
28 assertEq(major == 0, true);