summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/iterator-indices-1.js
blob: 913daa9a26f65c2768949118dfddcb1756cb2e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function test(obj, expected) {
  var count = 0;
  for (var s in obj) {
    if (obj.hasOwnProperty(s)) {
      count++;
    }
  }
  assertEq(count, expected);
}

var arr = [];
for (var i = 0; i < 20; i++) {
  var obj = {};
  for (var j = 0; j < i; j++) {
    obj["x_" + i + "_" + j] = 1;
  }
  arr.push(obj);
}

// Test fixed and dynamic slots
with ({}) {}
for (var i = 0; i < 2000; i++) {
  var idx = i % arr.length;
  test(arr[idx], idx);
}