tor-browser

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

fun-call-not-inlined.js (678B)


      1 // |jit-test| --fast-warmup
      2 
      3 // Call a scripted function instead of Function.prototype.call.
      4 function testScriptedAtFunCallOp() {
      5    var f = function(x) {
      6        if (x === 130) bailout();
      7        return x;
      8    };
      9    f.call = f;
     10 
     11    for (var i = 0; i < 150; i++) {
     12        assertEq(f.call(i), i);
     13    }
     14 }
     15 testScriptedAtFunCallOp();
     16 
     17 // Call Function.prototype.call instead of a "normal" function.
     18 function testFunCallAtNormalCallOp() {
     19    var f = function(x) {
     20        if (x === 130) bailout();
     21        return x;
     22    };
     23    f.myCall = Function.prototype.call;
     24 
     25    for (var i = 0; i < 150; i++) {
     26        assertEq(f.myCall(null, i), i);
     27    }
     28 }
     29 testFunCallAtNormalCallOp();