Debian Codegraph @

js/src/jit-test/tests/cacheir/fun-apply-as-call-native-1.js

raw
1 // Function.prototype.apply is inlined as Function.prototype.call when it's
2 // called with less than two arguments.
3 //
4 // Test monomorphic calls.
5
6 function testThisAbsent() {
7 for (let i = 0; i < 200; ++i) {
8 let r = Math.min.apply();
9 assertEq(r, Infinity);
10 }
11 }
12 for (let i = 0; i < 2; ++i) testThisAbsent();
13
14 function test0() {
15 for (let i = 0; i < 200; ++i) {
16 let r = Math.min.apply(null);
17 assertEq(r, Infinity);
18 }
19 }
20 for (let i = 0; i < 2; ++i) test0();
21
22 // NOTE: We don't yet inline the case when the second argument is |null|.
23 function test1Null() {
24 for (let i = 0; i < 200; ++i) {
25 let r = Math.min.apply(null, null);
26 assertEq(r, Infinity);
27 }
28 }
29 for (let i = 0; i < 2; ++i) test1Null();
30
31 // NOTE: We don't yet inline the case when the second argument is |undefined|.
32 function test1Undefined() {
33 for (let i = 0; i < 200; ++i) {
34 let r = Math.min.apply(null, undefined);
35 assertEq(r, Infinity);
36 }
37 }
38 for (let i = 0; i < 2; ++i) test1Undefined();