[JSC] AI should not propagate AbstractValue relying on constant folding phase
[WebKit-https.git] / JSTests / microbenchmarks / infer-one-time-deep-closure.js
1 function fooMaker(aParam) {
2     var a = aParam;
3     return function(bParam) {
4         var b = bParam;
5         return function(cParam) {
6             var c = cParam;
7             return function(dParam) {
8                 var d = dParam;
9                 return function(eParam) {
10                     var e = eParam;
11                     return function (fParam) {
12                         var f = a + b + c + d + e + fParam;
13                         for (var i = 0; i < 1000; ++i)
14                             f += a;
15                         return f;
16                     };
17                 };
18             };
19         };
20     };
21 }
22
23 var foo = fooMaker(42)(1)(2)(3)(4);
24
25 noInline(foo);
26
27 for (var i = 0; i < 20000; ++i) {
28     var result = foo(5);
29     if (result != 42057)
30         throw "Error: bad result: " + result;
31 }
32
33 var result = fooMaker(23)(2)(3)(4)(5)(5);
34 if (result != 23042)
35     throw "Error: bad result: " + result;