summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/cacheir/bug1804634.js
blob: c34e815f6b74db15ac80ab0a2e31234cb1b71ab9 (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
// |jit-test| --ion-instruction-reordering=off

function inner(o) {
  return o.x;
}
function outer(o) {
  return inner(o);
}

with ({}) {}

var arr = [];
for (var i = 0; i < 3; i++) {
  var obj = {x: 1};
  obj["y" + i] = 2;
  arr.push(obj);
}

// Transpile a GuardMultipleShapes with 3 shapes.
for (var i = 0; i < 2000; i++) {
  assertEq(outer(arr[i % arr.length]), 1);
}

// Bail out ten times with new shapes.
for (var i = 0; i < 10; i++) {
  var obj = {x: 1};
  obj["z" + i] = 3;
  assertEq(outer(obj), 1);
}

// Trigger a recompilation.
for (var i = 0; i < 2000; i++) {
  assertEq(outer(arr[i % arr.length]), 1);
}