summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/indexed-iteration.js
blob: 952aa105ba4a032cdd985b8cb82e31e66dc32fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

// Don't use NativeIterator cache for objects with dense elements.

function bar(a) {
  var n = 0;
  for (var b in a) { n++; }
  return n;
}

function foo() {
  var x = {a:0,b:1};
  var y = {a:0,b:1};
  y[0] = 2;
  y[1] = 3;
  for (var i = 0; i < 10; i++) {
    assertEq(bar(x), 2);
    assertEq(bar(y), 4);
  }
}
foo();