]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/call-varargs-from-inlined-code-with-odd-number-of-arguments.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / call-varargs-from-inlined-code-with-odd-number-of-arguments.js
1 function foo(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) {
2 return a * 2 + b * 3 + c * 5 + d * 7 + e * 11 + f * 13 + g * 17 + h * 19 + i * 23 + j * 29 + k * 31 + l * 37 + m * 41 + n * 43 + o * 47 + p * 53 + q * 59 + r * 61 + s * 67 + t * 71 + u * 73 + v * 79 + w * 83 + x * 89 + y * 97;
3 }
4
5 function bar() {
6 return foo.apply(this, arguments);
7 }
8
9 function baz(x) {
10 return bar(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) + x;
11 }
12
13 noInline(baz);
14
15 for (var i = 0; i < 10000; ++i) {
16 var result = baz(0);
17 if (result != 21586 - 26 * 101)
18 throw "Error: bad result: " + result;
19 }
20
21 // Force recompilation.
22 for (var i = 0; i < 10000; ++i) {
23 var result = baz(2147483646);
24 if (result != 2147502606)
25 throw "Error: bad result: " + result;
26 }