summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/cacheir/fun-call-inline-native-1.js
blob: c7e6fd31839ce208f19dbc600a32cd36433d2939 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Test inlining natives through Function.prototype.call
//
// Math.min() is inlined when there are 1-4 arguments.

function mathMinThisAbsent() {
  for (let i = 0; i < 400; ++i) {
    let r = Math.min.call();
    assertEq(r, Infinity);
  }
}
for (let i = 0; i < 2; ++i) mathMinThisAbsent();

function mathMin0() {
  for (let i = 0; i < 400; ++i) {
    let r = Math.min.call(null);
    assertEq(r, Infinity);
  }
}
for (let i = 0; i < 2; ++i) mathMin0();

function mathMin1() {
  for (let i = 0; i < 400; ++i) {
    let r = Math.min.call(null, i);
    assertEq(r, i);
  }
}
for (let i = 0; i < 2; ++i) mathMin1();

function mathMin2() {
  for (let i = 0; i < 400; ++i) {
    let r = Math.min.call(null, i, i + 1);
    assertEq(r, i);
  }
}
for (let i = 0; i < 2; ++i) mathMin2();

function mathMin3() {
  for (let i = 0; i < 400; ++i) {
    let r = Math.min.call(null, i, i + 1, i + 2);
    assertEq(r, i);
  }
}
for (let i = 0; i < 2; ++i) mathMin3();

function mathMin4() {
  for (let i = 0; i < 400; ++i) {
    let r = Math.min.call(null, i, i + 1, i + 2, i + 3);
    assertEq(r, i);
  }
}
for (let i = 0; i < 2; ++i) mathMin4();

function mathMin5() {
  for (let i = 0; i < 400; ++i) {
    let r = Math.min.call(null, i, i + 1, i + 2, i + 3, i + 4);
    assertEq(r, i);
  }
}
for (let i = 0; i < 2; ++i) mathMin5();