| capturedArgs = foo.arguments; |
| function arraycmp(a, b) { |
| if (a.length != b.length) |
| for (var i = 0; i < a.length; ++i) { |
| for (var i = 0; i < 10000; ++i) { |
| var result = foo(1, 2, 3, 4, 5, 6); |
| throw "Error: bad result in loop: " + result; |
| if (!arraycmp(capturedArgs, [1, 2, 3, 4, 5, 6])) |
| throw "Error: bad captured arguments in loop: " + capturedArgs; |
| var result = foo(2000000000, 2000000000, 3, 4, 5, 6); |
| if (result != 4000000000) |
| throw "Error: bad result at end: " + result; |
| if (!arraycmp(capturedArgs, [2000000000, 2000000000, 3, 4, 5, 6])) |
| throw "Error: bad captured arguments at end: " + Array.prototype.join.apply(capturedArgs, ","); |