]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/new-double-array-with-size.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / new-double-array-with-size.js
CommitLineData
81345200
A
1function foo(x) {
2 return new Array(x);
3}
4
5noInline(foo);
6
7function test(size) {
8 var result = foo(size);
9 if (result.length != size)
10 throw "Error: bad result: " + result;
11 var sawThings = false;
12 for (var s in result)
13 sawThings = true;
14 if (sawThings)
15 throw "Error: array is in bad state: " + result;
16 result[0] = 42.5;
17 if (result[0] != 42.5)
18 throw "Error: array is in wierd state: " + result;
19}
20
21for (var i = 0; i < 100000; ++i) {
22 test(0);
23 test(1);
24 test(42);
25}