summaryrefslogtreecommitdiffstats
path: root/js/src/devtools/gc-ubench/benchmarks/propertyTreeSplitting.js
blob: 47001030f4bbb9d3e82b38483a904bad6327e8f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
window.tests.set('propertyTreeSplitting', (function() {
var garbage = [];
var garbageIndex = 0;
return {
    description: "use delete to generate Shape garbage",
    load: (N) => { garbage = new Array(N); },
    unload: () => { garbage = []; garbageIndex = 0; },
    makeGarbage: (N) => {
        function f()
        {
            var a1 = eval;
            delete eval;
            eval = a1;
            var a3 = toString;
            delete toString;
            toString = a3;
        }
        for (var a = 0; a < N; ++a) {
            garbage[garbageIndex++] = new f();
            if (garbageIndex == garbage.length)
                garbageIndex = 0;
        }
    }
};
})());