tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

conditional-test-undefined-1.js (534B)


      1 function g(array) {
      2  // 1. Absent properties return |undefined| from CacheIR.
      3  // 2. Tests on |undefined| are changed to |false| in CacheIR.
      4  //
      5  // When Warp compiling the CacheIR ops, the first test will then happen on
      6  // a boolean, whereas the phi still sees the original undefined value.
      7  if (array.does_not_exist || array.slice) {
      8    return 1;
      9  }
     10  return 0;
     11 }
     12 
     13 function f() {
     14  var array = [];
     15  var r = 0;
     16  for (let i = 0; i < 100; ++i) {
     17    r += g(array);
     18  }
     19  assertEq(r, 100);
     20 }
     21 
     22 for (let i = 0; i < 2; ++i) f();