summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/jaeger/loops/property-1.js
blob: 81a6b3c3601704412bc033bb97cb71f1676dcf10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function foo(x, y) {
  var res = 0;
  for (var i = 0; i < 10; i++) {
    res += x.f + y[i];
  }
  return res;
}

var x = {f:0};
var y = Array(10);
for (var i = 0; i < 10; i++) {
  if (i == 5)
    Object.defineProperty(Object.prototype, 5, {get: function() { x.f = 10; return 5}});
  else
    y[i] = i;
}

assertEq(foo(x, y), 85);