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

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

class Foo {
  constructor(i) {
    this.value = i;
  }
}

class Bar extends Foo {
  constructor(n, ...args) {
    escape(args);
    super(...args);
  }
}

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

class Baz extends Bar {
  constructor(a, n) {
    super(n, n);
  }
}

var sum = 0;
for (var i = 0; i < 10000; i++) {
  let obj = new Baz(0, 1);
  sum += obj.value;
}
assertEq(sum, 10000);