summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/cacheir/topropertykey.js
blob: 69f9e1be9d93d9b272386574160bd29624ecf377 (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
35
36
setJitCompilerOption("ion.forceinlineCaches", 1);

function testInt32() {
  var xs = [0, 0];
  var a = [0];

  for (var i = 0; i < 20; ++i) {
      var key = xs[i & 1];
      assertEq(a[key]++, i);
  }
}
for (var i = 0; i < 2; ++i) testInt32();

function testStringInt32() {
  var xs = ["0", "0"];
  var a = [0];

  for (var i = 0; i < 20; ++i) {
      var key = xs[i & 1];
      assertEq(a[key]++, i);
  }
}
for (var i = 0; i < 2; ++i) testStringInt32();

function testString() {
  var xs = ["p", "p"];
  var a = {
    p: 0,
  };

  for (var i = 0; i < 20; ++i) {
      var key = xs[i & 1];
      assertEq(a[key]++, i);
  }
}
for (var i = 0; i < 2; ++i) testString();