]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/varargs-inlined-simple-exit-aliasing.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / varargs-inlined-simple-exit-aliasing.js
CommitLineData
ed1e77d3
A
1function foo(a, b) {
2 return a + b;
3}
4
5function verify(a, b) {
6 if (a !== b)
7 throw "Error: the two arguments objects aren't identical.";
8 if (a[0] !== 42)
9 throw "Error: the first argument isn't 42 (a).";
10 if (b[0] !== 42)
11 throw "Error: the first argument isn't 42 (b).";
12}
13
14noInline(verify);
15
16var global = false;
17function bar(x) {
18 var a = arguments;
19 if (global) {
20 x = 42;
21 verify(arguments, a);
22 }
23 return foo.apply(null, a);
24}
25
26function baz(a, b) {
27 return bar(a, b);
28}
29
30noInline(baz);
31
32for (var i = 0; i < 10000; ++i) {
33 var result = baz(1, 2);
34 if (result != 1 + 2)
35 throw "Error: bad result: " + result;
36}
37
38global = true;
39var result = baz(1, 2);
40if (result != 42 + 2)
41 throw "Error: bad result at end: " + result;