summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/iterator-indices-8.js
blob: b27cd5f4dc7110f2d7408bda9f751f3ef25bf0a4 (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
// Tests megamorphic stores to fixed and dynamics slots, and dense elements
function test(obj) {
  let index = 0;
  for (var s in obj) {
    obj[s] = index;
    index++;
  }
  index = 0;
  for (var s in obj) {
    assertEq(obj[s], index);
    index++;
  }
}

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

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