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