summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/warp/conditional-test-undefined-1.js
blob: 382f3ca966ecb887f40e4937caa02496d6c260fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function g(array) {
  // 1. Absent properties return |undefined| from CacheIR.
  // 2. Tests on |undefined| are changed to |false| in CacheIR.
  //
  // When Warp compiling the CacheIR ops, the first test will then happen on
  // a boolean, whereas the phi still sees the original undefined value.
  if (array.does_not_exist || array.slice) {
    return 1;
  }
  return 0;
}

function f() {
  var array = [];
  var r = 0;
  for (let i = 0; i < 100; ++i) {
    r += g(array);
  }
  assertEq(r, 100);
}

for (let i = 0; i < 2; ++i) f();