tor-browser

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

baseline-hints-2.js (1003B)


      1 // |jit-test| --blinterp-warmup-threshold=1000; --baseline-warmup-threshold=1000
      2 // Simple test to make sure we enter baseline eagerly if a hint is set.
      3 
      4 if (typeof getJitCompilerOptions == "function" && 
      5    typeof inJit == "function" && 
      6    typeof setBaselineHint == "function" && 
      7    typeof hasBaselineHint == "function") {
      8 
      9  var jco = getJitCompilerOptions();
     10  if (jco["baseline.enable"] && jco["blinterp.enable"] &&
     11    jco["blinterp.warmup.trigger"] == 1000 &&
     12    jco["baseline.warmup.trigger"] == 1000) {
     13 
     14    function testFunction() {
     15      return inJit();
     16    }
     17 
     18    // Confirm not in baseline.
     19    assertEq(hasBaselineHint(testFunction), false);
     20    in_jit = testFunction();
     21    assertEq(in_jit, false);
     22 
     23    // Set an eager baseline hint.
     24    setBaselineHint(testFunction);
     25    assertEq(hasBaselineHint(testFunction), true);
     26 
     27    // Confirm testFunction is now in baseline even though
     28    // threshold has not been reached.
     29    in_jit = testFunction();
     30    assertEq(in_jit, true);
     31  }
     32 }