summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/jaeger/inline/scripted-02.js
blob: fede7f494388853f674216dfff20ba21f4b3f245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function getter(a, i) {
  return a[i];
}

function foo(a, n) {
  var res = 0;
  for (var i = 0; i < 10; i++) {
    res = 0;
    for (var j = 0; j < n; j++) {
      res += getter(a, j);
    }
  }
  return res;
}

var n = 100;
var a = Array(n);
for (var i = 0; i < n; i++)
  a[i] = i;

var q = foo(a, n);
assertEq(q, 4950);