diff options
Diffstat (limited to 'js/src/jit-test/tests/warp/guard-function-is-non-builtin-ctor.js')
-rw-r--r-- | js/src/jit-test/tests/warp/guard-function-is-non-builtin-ctor.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/warp/guard-function-is-non-builtin-ctor.js b/js/src/jit-test/tests/warp/guard-function-is-non-builtin-ctor.js new file mode 100644 index 0000000000..c2b92d4510 --- /dev/null +++ b/js/src/jit-test/tests/warp/guard-function-is-non-builtin-ctor.js @@ -0,0 +1,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(); |