Debian Codegraph @

js/src/devtools/gc-ubench/benchmarks/globalArrayLargeObject.js

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 tests.set(
6 "globalArrayLargeObject",
7 (function() {
8 var garbage = [];
9 var garbageIndex = 0;
10 return {
11 description: "var foo = { LARGE }; # (large slots)",
12
13 load: N => {
14 garbage = new Array(N);
15 },
16 unload: () => {
17 garbage = [];
18 garbageIndex = 0;
19 },
20
21 defaultGarbagePiles: "8K",
22 defaultGarbagePerFrame: "64K",
23
24 makeGarbage: N => {
25 var obj = {};
26 for (var i = 0; i < N; i++) {
27 obj["key" + i] = i;
28 }
29 garbage[garbageIndex++] = obj;
30 if (garbageIndex == garbage.length) {
31 garbageIndex = 0;
32 }
33 },
34 };
35 })()
36 );