summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/iterator-indices-6.js
blob: bf36aa97c235784b1bad2f8d8ba2d2d9da1c2a13 (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
var iters = 0;

function test(o1, o2) {
  var count = 0;
  for (var s1 in o1) {
    for (var s2 in o2) {
      if (Object.hasOwn(o1, s1)) {
	count += o1[s1];
      }
      if (Object.hasOwn(o2, s2)) {
	count += o2[s2];
      }
    }
  }
  assertEq(count, 2);
}

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

with ({}) {}
for (var i = 0; i < 2000; i++) {
  var idx1 = i % arr.length;
  var idx2 = 1 + i % (arr.length - 1);
  test(arr[idx1], arr[idx2]);
}