]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/exit-from-ftl-when-caller-passed-extra-args-then-use-function-dot-arguments.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / exit-from-ftl-when-caller-passed-extra-args-then-use-function-dot-arguments.js
CommitLineData
81345200
A
1function foo(a, b) {
2 var result = a + b;
3 bar();
4 return result;
5}
6
7var capturedArgs;
8function bar() {
9 capturedArgs = foo.arguments;
10}
11
12noInline(foo);
13noInline(bar);
14
15function 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
25for (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
33var result = foo(2000000000, 2000000000, 3, 4, 5, 6);
34if (result != 4000000000)
35 throw "Error: bad result at end: " + result;
36if (!arraycmp(capturedArgs, [2000000000, 2000000000, 3, 4, 5, 6]))
37 throw "Error: bad captured arguments at end: " + Array.prototype.join.apply(capturedArgs, ",");