]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/new-array-with-size-throw-exception-and-tear-off-arguments.js
JavaScriptCore-7600.1.4.16.1.tar.gz
[apple/javascriptcore.git] / tests / stress / new-array-with-size-throw-exception-and-tear-off-arguments.js
1 function foo() {
2 var a = arguments;
3 return new Array(a[0]);
4 }
5
6 function bar(x) {
7 return foo(x);
8 }
9
10 noInline(bar);
11
12 for (var i = 0; i < 10000; ++i) {
13 var result = bar(42);
14 if (result.length != 42)
15 throw "Error: bad result length: " + result;
16 }
17
18 var didThrow = false;
19 try {
20 bar(-1);
21 } catch (e) {
22 didThrow = e;
23 }
24
25 if (("" + didThrow).indexOf("RangeError") != 0)
26 throw "Error: did not throw right exception: " + didThrow;