]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/call-varargs-from-inlined-code.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / call-varargs-from-inlined-code.js
CommitLineData
81345200
A
1function 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, z) {
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 + z * 101;
3}
4
5function bar() {
6 return foo.apply(this, arguments);
7}
8
9function 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, 26) + x;
11}
12
13noInline(baz);
14
15for (var i = 0; i < 10000; ++i) {
16 var result = baz(0);
17 if (result != 21586)
18 throw "Error: bad result: " + result;
19}
20
21// Force recompilation.
22for (var i = 0; i < 10000; ++i) {
23 var result = baz(2147483646);
24 if (result != 2147505232)
25 throw "Error: bad result: " + result;
26}