fun-apply-as-call-scripted-1.js (972B)
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 one() { 7 return 1; 8 } 9 10 function testThisAbsent() { 11 for (let i = 0; i < 200; ++i) { 12 let r = one.apply(); 13 assertEq(r, 1); 14 } 15 } 16 for (let i = 0; i < 2; ++i) testThisAbsent(); 17 18 function test0() { 19 for (let i = 0; i < 200; ++i) { 20 let r = one.apply(null); 21 assertEq(r, 1); 22 } 23 } 24 for (let i = 0; i < 2; ++i) test0(); 25 26 // NOTE: We don't yet inline the case when the second argument is |null|. 27 function test1Null() { 28 for (let i = 0; i < 200; ++i) { 29 let r = one.apply(null, null); 30 assertEq(r, 1); 31 } 32 } 33 for (let i = 0; i < 2; ++i) test1Null(); 34 35 // NOTE: We don't yet inline the case when the second argument is |undefined|. 36 function test1Undefined() { 37 for (let i = 0; i < 200; ++i) { 38 let r = one.apply(null, undefined); 39 assertEq(r, 1); 40 } 41 } 42 for (let i = 0; i < 2; ++i) test1Undefined();