tor-browser

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

stub-folding.js (466B)


      1 // |jit-test| --fast-warmup
      2 
      3 with({}) {}
      4 
      5 class A {
      6    foo() { return 3; }
      7    get z() { return 5; }
      8 }
      9 
     10 class B1 extends A {
     11    constructor(y) {
     12        super();
     13        this.y = y;
     14    }
     15 }
     16 
     17 class B2 extends A {
     18    constructor(x,y) {
     19        super();
     20        this.y = y;
     21        this.x = x;
     22    }
     23 }
     24 
     25 var sum = 0;
     26 function foo(o) {
     27    sum += o.foo() + o.y + o.z;
     28 }
     29 
     30 for (var i = 0; i < 50; i++) {
     31    foo(new B1(i));
     32    foo(new B2(i,i));
     33 }
     34 
     35 assertEq(sum, 3250);