Debian Codegraph @

js/src/jit-test/tests/warp/stub-folding-add-case.js

raw
1 // |jit-test| --fast-warmup
2
3 var sum = 0;
4 function foo(o) {
5 sum += o.a;
6 }
7
8 with({}) {}
9
10 // Fold a stub with two cases.
11 for (var i = 0; i < 11; i++) {
12 foo({a:1});
13 foo({a:1,b:2});
14 }
15
16 // Add a third case.
17 foo({a:1,b:2,c:3});
18
19 // Warp-compile.
20 for (var i = 0; i < 16; i++) {
21 foo({a:1});
22 }
23
24 // Add a fourth case.
25 foo({a:1,b:2,c:3,d:4});
26
27 // Run for a while in Warp.
28 for (var i = 0; i < 20; i++) {
29 foo({a:1});
30 foo({a:1,b:2});
31 foo({a:1,b:2,c:3});
32 foo({a:1,b:2,c:3,d:4});
33 }
34
35 assertEq(sum, 120);