summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/warp/scalar-replace-array-construct-array-02.js
blob: 06d44779c177529350427448e3cf1a60253cffe8 (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
setJitCompilerOption("inlining.bytecode-max-length", 200);

class Bar {
  constructor(x, y) {
    this.value = x + y;
  }
}

class Foo extends Bar {
  constructor(...args) {
    args[0] = 3;
    super(...args);
  }
}

// |Foo| must be small enough to be inlinable.
assertEq(isSmallFunction(Foo), true);

with ({}) {}

var sum = 0;
for (var i = 0; i < 100; i++) {
  let obj = new Foo(1, 2);
  sum += obj.value;
}
assertEq(sum, 500);