tor-browser

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

scalar-replace-array-construct-array-01.js (470B)


      1 setJitCompilerOption("inlining.bytecode-max-length", 200);
      2 
      3 function escape(x) { with ({}) {} }
      4 
      5 class Bar {
      6  constructor(x, y) {
      7    this.value = x + y;
      8  }
      9 }
     10 
     11 class Foo extends Bar {
     12  constructor(...args) {
     13    escape(args);
     14    super(...args);
     15  }
     16 }
     17 
     18 // |Foo| must be small enough to be inlinable.
     19 assertEq(isSmallFunction(Foo), true);
     20 
     21 with ({}) {}
     22 
     23 var sum = 0;
     24 for (var i = 0; i < 100; i++) {
     25  let obj = new Foo(1, 2);
     26  sum += obj.value;
     27 }
     28 assertEq(sum, 300);