Bug 1125398 - Benchmark load: self-referential WeakMap, r=terrence

--HG--
extra : rebase_source : b15841d8795dd93b6009e57c76f87d33b6c5b34c
This commit is contained in:
Steve Fink 2015-01-13 09:15:30 -08:00
parent 4aa286cfa8
commit 30ee3c7040
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,29 @@
window.tests.set('selfCyclicWeakMap', (function() {
var garbage = [];
var garbageIndex = 0;
return {
description: "var wm = new WeakMap(); wm[k1] = k2; wm[k2] = k3; ...",
defaultGarbagePerFrame: "1K",
defaultGarbageTotal: "1K",
load: (N) => { garbage = new Array(N); },
unload: () => { garbage = []; garbageIndex = 0; },
makeGarbage: (M) => {
var wm = new WeakMap();
var initialKey = {};
var key = initialKey;
var value = {};
for (var i = 0; i < M; i++) {
wm.set(key, value);
key = value;
value = {};
}
garbage[garbageIndex++] = [ initialKey, wm ];
if (garbageIndex == garbage.length)
garbageIndex = 0;
}
};
})());

View File

@ -11,6 +11,7 @@
<script src="benchmarks/globalArrayLargeArray.js"></script>
<script src="benchmarks/globalArrayObjectLiteral.js"></script>
<script src="benchmarks/globalArrayReallocArray.js"></script>
<script src="benchmarks/selfCyclicWeakMap.js"></script>
<script src="harness.js"></script>