summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/iterator-indices-9.js
blob: 631beee5d323468955b4be109eb8d5af72710215 (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
26
27
28
29
30
31
32
33
34
// Tests SetPropertyCache sets to object.
function test(obj) {
  let index = 0;
  for (var s in obj) {
    if (s.startsWith("test")) {
      obj[s] = index;
    }
    index++;
  }
  index = 0;
  for (var s in obj) {
    if (s.startsWith("test")) {
      assertEq(obj[s], index);
    }
    index++;
  }
}

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

with ({}) {}
for (var i = 0; i < 2000; i++) {
  var idx = i % arr.length;
  test(arr[idx]);
}