]>
Commit | Line | Data |
---|---|---|
1 | var foo = function(o) { | |
2 | return arguments; | |
3 | }; | |
4 | ||
5 | var bar = function() { | |
6 | var a = Array.prototype.slice.call(arguments); | |
7 | var sum = 0; | |
8 | for (var i = 0; i < a.length; ++i) | |
9 | sum += a[i]; | |
10 | return sum; | |
11 | }; | |
12 | ||
13 | var args = foo({}, 1, 2, 3); | |
14 | var expectedArgs = Array.prototype.slice.call(args); | |
15 | ||
16 | edenGC(); | |
17 | ||
18 | var expectedResult = 0; | |
19 | var result = 0; | |
20 | for (var i = 0; i < 10000; ++i) { | |
21 | expectedResult += i + i + 1 + i + 2; | |
22 | result += bar(i, i + 1, i + 2); | |
23 | } | |
24 | ||
25 | if (result != expectedResult) | |
26 | throw new Error("Incorrect result: " + result + " != " + expectedResult); | |
27 | ||
28 | for (var i = 0; i < expectedArgs.length; ++i) { | |
29 | if (args[i] !== expectedArgs[i]) | |
30 | throw new Error("Incorrect arg result"); | |
31 | } | |
32 |