summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/warp/stub-folding.js
blob: 0b7d7fdda4930adfeeb1ebaa52fca61c904b0cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// |jit-test| --fast-warmup

with({}) {}

class A {
    foo() { return 3; }
    get z() { return 5; }
}

class B1 extends A {
    constructor(y) {
        super();
        this.y = y;
    }
}

class B2 extends A {
    constructor(x,y) {
        super();
        this.y = y;
        this.x = x;
    }
}

var sum = 0;
function foo(o) {
    sum += o.foo() + o.y + o.z;
}

for (var i = 0; i < 50; i++) {
    foo(new B1(i));
    foo(new B2(i,i));
}

assertEq(sum, 3250);