blob: 5d396d426ed36341e0b37f5d6ab2740209bf7354 (
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
|
// Test inlining natives through Function.prototype.call
//
// Array() is inlined when there are 0-1 arguments.
function arrayThisAbsent() {
for (let i = 0; i < 400; ++i) {
let r = Array.call();
assertEq(r.length, 0);
}
}
for (let i = 0; i < 2; ++i) arrayThisAbsent();
function array0() {
for (let i = 0; i < 400; ++i) {
let r = Array.call(null);
assertEq(r.length, 0);
}
}
for (let i = 0; i < 2; ++i) array0();
function array1() {
for (let i = 0; i < 400; ++i) {
let r = Array.call(null, 5);
assertEq(r.length, 5);
}
}
for (let i = 0; i < 2; ++i) array1();
function array2() {
for (let i = 0; i < 400; ++i) {
let r = Array.call(null, 5, 10);
assertEq(r.length, 2);
}
}
for (let i = 0; i < 2; ++i) array2();
|