Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / regress / script-tests / make-indexed-storage.js
blob045fce72eec5d3185d4660cbdc5f4d83ea8e3b8b
1 function foo(length) {
2 var o = {};
3 o.length = length;
4 for (var i = 0; i < o.length; ++i)
5 o[i] = i; // The first iteration is special as it makes indexed storage. If the DFG doesn't know how to optimize that and instead calls a C function, then this benchmark may not run so quickly.
6 return o;
9 function sum(o) {
10 var result = 0;
11 for (var i = 0; i < o.length; ++i)
12 result += o[i];
13 return result;
16 var result = 0;
17 for (var i = 0; i < 2000; ++i)
18 result += sum(foo(100));
20 if (result != 9900000)
21 throw "Error: bad result: " + result;