]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/load-varargs-then-inlined-call-and-exit.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / load-varargs-then-inlined-call-and-exit.js
CommitLineData
ed1e77d3
A
1function foo(a, b) {
2 var array = [];
3 for (var i = 0; i < arguments.length; ++i)
4 array.push(arguments[i]);
5 return {a:a + 1, b:b, c:array};
6}
7
8function bar(array) {
9 return foo.apply(this, array);
10}
11
12noInline(bar);
13
14function checkEqual(a, b) {
15 if (a.a != b.a)
16 throw "Error: bad value of a: " + a.a + " versus " + b.a;
17 if (a.b != b.b)
18 throw "Error: bad value of b: " + a.b + " versus " + b.b;
19 if (a.c.length != b.c.length)
20 throw "Error: bad value of c, length mismatch: " + a.c + " versus " + b.c;
21 for (var i = a.c.length; i--;) {
22 if (a.c[i] != b.c[i])
23 throw "Error: bad value of c, mismatch at i = " + i + ": " + a.c + " versus " + b.c;
24 }
25}
26
27function test(array) {
28 var expected = {a:array[0] + 1, b:array[1], c:array};
29 var actual = bar(array);
30 checkEqual(actual, expected);
31}
32
33for (var i = 0; i < 10000; ++i) {
34 var array = [];
35 for (var j = 0; j < 1 + (i % 5); ++j)
36 array.push(j);
37 test(array);
38}
39
40var array = [2147483647];
41test(array);