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

function escape(x) { with ({}) {} }

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

class Foo extends Bar {
  constructor(...args) {
    escape(args);
    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, 300);