]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/flatten-oversize-dictionary-object.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / flatten-oversize-dictionary-object.js
CommitLineData
81345200
A
1var foo = function(o) {
2 return o.baa;
3};
4
5noInline(foo);
6
7(function() {
8 var letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
9 var properties = [];
10 var o = {};
11 for (var i = 0; i < letters.length; ++i) {
12 for (var j = 0; j < letters.length; ++j) {
13 for (var k = 0; k < letters.length; ++k) {
14 var property = letters[i] + letters[j] + letters[k];
15 o[property] = i;
16 }
17 }
18 }
19
20 var keys = Object.keys(o);
21 keys.sort();
22 for (var i = keys.length - 1; i >= keys.length - 8000; i--) {
23 delete o[keys[i]];
24 }
25
26 var sum = 0;
27 var iVal = letters.indexOf("b");
28 var niters = 1000;
29 for (var i = 0; i < niters; ++i) {
30 sum += foo(o);
31 }
32
33 if (sum != iVal * niters)
34 throw new Error("incorrect result: " + sum);
35
36 fullGC();
37})();