summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/auto-regress/bug1765249.js
blob: 9c6ae09b92d209a47d70126cb7bfcab6a2f7629c (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
  // |jit-test| --fast-warmup; --no-threads

function main() {
  // Disable Warp compilation, so we don't inline |f|.
  with ({}) {}

  let begin = 0;
  for (let i = 1; i < 30; i++) {
    f(begin);
    begin = undefined;
  }
}
main();

function g(i) {
  return i < 3;
}

function f(begin) {
  // Loop body is only reachable on the first invocation.
  for (let i = begin; i < 5; i++) {
    // |arguments| with out-of-bounds access. This adds a guard on the prototype
    // of the arguments object.
    arguments[100];

    // Loop with a call expression. This ensures we emit bail instructions for
    // unreachable code after the first invocation.
    for (let j = 0; g(j); j++) {}

    // Change the prototype of the arguments object. This will cause a failure
    // on the prototype guard added above.
    arguments.__proto__ = {};
  }
}