]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/elidable-new-object-roflcopter-then-exit.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / elidable-new-object-roflcopter-then-exit.js
1 function sumOfArithSeries(limit) {
2 return limit * (limit + 1) / 2;
3 }
4
5 var n = 1000000;
6
7 var array = [42, "hello"];
8
9 function foo() {
10 var result = 0;
11 var q;
12 for (var i = 0; i < n; ++i) {
13 var o = {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: i}}}}}}}}}}}}}}}}}}};
14 var p = {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: {f: i + 1}}}}}}}}}}}}}}}}}}};
15 q = array[(i > n - 100) | 0] + 1;
16 result += o.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f + p.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f;
17 }
18 return q + result;
19 }
20
21 var result = foo();
22 if (result != "hello" + 1 + (sumOfArithSeries(n - 1) + sumOfArithSeries(n)))
23 throw "Error: bad result: " + result;