Debian Codegraph @

js/src/jit-test/tests/gc/incremental-compacting.js

raw
1 // Exercise incremental compacting GC
2 // Run with MOZ_GCTIMER to see the timings
3
4 gczeal(0);
5
6 function testCompacting(zoneCount, objectCount, sliceCount)
7 {
8 // Allocate objectCount objects in zoneCount zones
9 // On linux64 debug builds we will move them all
10 // Run compacting GC with multiple slices
11
12 var zones = [];
13 for (var i = 0; i < zoneCount; i++) {
14 var zone = newGlobal();
15 evaluate("var objects; " +
16 "function makeObjectGraph(objectCount) { " +
17 " objects = []; " +
18 " for (var i = 0; i < objectCount; i++) " +
19 " objects.push({ serial: i }); " +
20 "}",
21 { global: zone });
22 zone.makeObjectGraph(objectCount);
23 zones.push(zone);
24 }
25
26 // Finish any alloc-triggered incremental GC
27 if (gcstate() !== "NotActive")
28 gc();
29
30 startgc(sliceCount, "shrinking");
31 while (gcstate() !== "NotActive") {
32 gcslice(sliceCount);
33 }
34
35 return zones;
36 }
37
38 testCompacting(1, 100000, 100000);
39 testCompacting(2, 100000, 100000);
40 testCompacting(4, 50000, 100000);
41 testCompacting(2, 100000, 50000);