tor-browser

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

bug908903.js (1109B)


      1 function f(x) {
      2    return x + 1;
      3 }
      4 
      5 setJitCompilerOption("ion.warmup.trigger", 2);
      6 setJitCompilerOption("baseline.warmup.trigger", 0);
      7 
      8 assertEq(f(1), 2);     // warm-up == 1 => eagerly compile with baseline.
      9 assertEq(f(0.5), 1.5); // warm-up == 2 => normaly compile with ion.
     10                       //                 invalidate for unexpect output.
     11 
     12 
     13 function normal() {
     14    setJitCompilerOption("ion.warmup.trigger", 8);
     15    setJitCompilerOption("baseline.warmup.trigger", 5);
     16 }
     17 
     18 function eager() {
     19    setJitCompilerOption("ion.warmup.trigger", 0);
     20 }
     21 
     22 function h(x) {
     23    return x + 1;
     24 }
     25 
     26 function g(x) {
     27    normal();
     28    return h(x) + 1;
     29 }
     30 
     31 normal();
     32 for (var i = 0; i < 10; i++) {
     33    eager();
     34    assertEq(g(i), i + 2);
     35 }
     36 
     37 
     38 // Check for wrong arguments.
     39 try {
     40    setJitCompilerOption("not.an.option", 51);
     41    assertEq(false, true);
     42 } catch (x) { }
     43 
     44 try {
     45    var ion = { warmup: { trigger: null } };
     46    setJitCompilerOption(ion.warmup.trigger, 42);
     47    assertEq(false, true);
     48 } catch (x) { }
     49 
     50 try {
     51    setJitCompilerOption("ion.warmup.trigger", "32");
     52    assertEq(false, true);
     53 } catch (x) { }