]>
Commit | Line | Data |
---|---|---|
ed1e77d3 A |
1 | function foo(a, b) { |
2 | return a + b; | |
3 | } | |
4 | ||
5 | function 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 | ||
14 | noInline(verify); | |
15 | ||
16 | var global = false; | |
17 | function 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 | ||
26 | function baz(a, b) { | |
27 | return bar(a, b); | |
28 | } | |
29 | ||
30 | noInline(baz); | |
31 | ||
32 | for (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 | ||
38 | global = true; | |
39 | var result = baz(1, 2); | |
40 | if (result != 42 + 2) | |
41 | throw "Error: bad result at end: " + result; |