blob: e73b090a700752fdd7d89e59c59a14ba2ab3d364 [file] [log] [blame]
//@ skip if $model == "Apple Watch Series 3" # added by mark-jsc-stress-test.py
//@ skip if $architecture == "x86"
function sumOfArithSeries(limit) {
return limit * (limit + 1) / 2;
}
var n = 10000000;
function foo() {
var result = 0;
for (var i = 0; i < n; ++i) {
var leaf = {f:i};
var o = {f:leaf};
var p = {f:leaf};
var q = {f:o, g:p};
result += q.f.f.f;
}
return result;
}
var result = foo();
if (result != sumOfArithSeries(n - 1))
throw "Error: bad result: " + result;