fun-call-bound-inline-native-2.js (741B)
1 // Test inlining bound natives through Function.prototype.call 2 3 function test(fn, expected) { 4 for (let i = 0; i < 400; ++i) { 5 let r = fn.call(null, 0, 1); 6 assertEq(r, expected); 7 } 8 } 9 10 for (let i = 0; i < 2; ++i) { 11 let fn, expected; 12 if (i === 0) { 13 fn = Math.min.bind(); 14 expected = 0; 15 } else { 16 fn = Math.max.bind(); 17 expected = 1; 18 } 19 test(fn, expected); 20 } 21 22 function testBound(fn, expected) { 23 for (let i = 0; i < 400; ++i) { 24 let r = fn.call(null, 0, 1); 25 assertEq(r, expected); 26 } 27 } 28 29 for (let i = 0; i < 2; ++i) { 30 let fn, expected; 31 if (i === 0) { 32 fn = Math.min.bind(null, -1); 33 expected = -1; 34 } else { 35 fn = Math.max.bind(null, 2); 36 expected = 2; 37 } 38 testBound(fn, expected); 39 }