blob: a31b0f2e7ec7d669e4c7c3d825deddb37ad48e44 (
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
|
// |jit-test| --fast-warmup
var sum = 0;
function foo(o) {
sum += o.a;
}
with({}) {}
// Fold a stub with two cases.
for (var i = 0; i < 11; i++) {
foo({a:1});
foo({a:1,b:2});
}
// Add a third case.
foo({a:1,b:2,c:3});
// Warp-compile.
for (var i = 0; i < 16; i++) {
foo({a:1});
}
// Add a fourth case.
foo({a:1,b:2,c:3,d:4});
// Run for a while in Warp.
for (var i = 0; i < 20; i++) {
foo({a:1});
foo({a:1,b:2});
foo({a:1,b:2,c:3});
foo({a:1,b:2,c:3,d:4});
}
assertEq(sum, 120);
|