Debian Codegraph @

js/src/jit-test/tests/cacheir/fun-call-inline-native-2.js

raw
1 // Test inlining 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;
14 expected = 0;
15 } else {
16 fn = Math.max;
17 expected = 1;
18 }
19 test(fn, expected);
20 }