Debian Codegraph @

js/src/jit-test/tests/warp/guard-function-is-non-builtin-ctor.js

raw
1 function test() {
2 for (var i = 0; i <= 200; ++i) {
3 // Create a fresh function in each iteration.
4 var values = [function(){}, () => {}];
5
6 // Use an arrow function in the last iteration.
7 var useArrowFn = (i === 200);
8
9 // No conditional (?:) so we don't trigger a cold-code bailout.
10 var value = values[0 + useArrowFn];
11
12 // Set or create the "prototype" property.
13 value.prototype = null;
14
15 // The "prototype" is configurable iff the function is an arrow function.
16 var desc = Object.getOwnPropertyDescriptor(value, "prototype");
17 assertEq(desc.configurable, useArrowFn);
18 }
19 }
20 test();