]>
Commit | Line | Data |
---|---|---|
81345200 A |
1 | function foo(a, b) { |
2 | var result = a + b; | |
3 | bar(); | |
4 | return result; | |
5 | } | |
6 | ||
7 | var capturedArgs; | |
8 | function bar() { | |
9 | capturedArgs = foo.arguments; | |
10 | } | |
11 | ||
12 | noInline(foo); | |
13 | noInline(bar); | |
14 | ||
15 | function arraycmp(a, b) { | |
16 | if (a.length != b.length) | |
17 | return false; | |
18 | for (var i = 0; i < a.length; ++i) { | |
19 | if (a[i] != b[i]) | |
20 | return false; | |
21 | } | |
22 | return true; | |
23 | } | |
24 | ||
25 | for (var i = 0; i < 10000; ++i) { | |
26 | var result = foo(1, 2, 3, 4, 5, 6); | |
27 | if (result != 3) | |
28 | throw "Error: bad result in loop: " + result; | |
29 | if (!arraycmp(capturedArgs, [1, 2, 3, 4, 5, 6])) | |
30 | throw "Error: bad captured arguments in loop: " + capturedArgs; | |
31 | } | |
32 | ||
33 | var result = foo(2000000000, 2000000000, 3, 4, 5, 6); | |
34 | if (result != 4000000000) | |
35 | throw "Error: bad result at end: " + result; | |
36 | if (!arraycmp(capturedArgs, [2000000000, 2000000000, 3, 4, 5, 6])) | |
37 | throw "Error: bad captured arguments at end: " + Array.prototype.join.apply(capturedArgs, ","); |