summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/warp/guard-function-is-non-builtin-ctor.js
blob: c2b92d4510c14b7f7d35bb59b77f56fc9fdd16df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function test() {
  for (var i = 0; i <= 200; ++i) {
    // Create a fresh function in each iteration.
    var values = [function(){}, () => {}];

    // Use an arrow function in the last iteration.
    var useArrowFn = (i === 200);

    // No conditional (?:) so we don't trigger a cold-code bailout.
    var value = values[0 + useArrowFn];

    // Set or create the "prototype" property.
    value.prototype = null;

    // The "prototype" is configurable iff the function is an arrow function.
    var desc = Object.getOwnPropertyDescriptor(value, "prototype");
    assertEq(desc.configurable, useArrowFn);
  }
}
test();