blob: 00c9ef99a53dfa30a9280f9f0f4ee5b7127cf0ce [file] [log] [blame]
function sumOfArithSeries(limit) {
return limit * (limit + 1) / 2;
}
var n = 10000000;
function bar() { }
function foo() {
var result = 0;
for (var i = 0; i < n; ++i) {
var o = {f: i};
var p = {f: i + 1};
result += o.f + p.f;
if (!(i % 100))
bar(o, p);
}
return result;
}
noInline(bar);
noInline(foo);
var result = foo();
if (result != sumOfArithSeries(n - 1) + sumOfArithSeries(n))
throw "Error: bad result: " + result;