]>
Commit | Line | Data |
---|---|---|
81345200 A |
1 | function foo(x) { |
2 | return new Array(x); | |
3 | } | |
4 | ||
5 | noInline(foo); | |
6 | ||
7 | function test(size) { | |
8 | var result = foo(size); | |
9 | if (result.length != size) { | |
10 | print("Got a weird length: " + result.length); | |
11 | throw "Error: bad result: " + result; | |
12 | } | |
13 | var sawThings = false; | |
14 | for (var s in result) | |
15 | sawThings = true; | |
16 | if (sawThings) { | |
17 | print("Saw things!"); | |
18 | throw "Error: array is in bad state: " + result; | |
19 | } | |
20 | result[0] = "42.5"; | |
21 | if (result[0] != "42.5") { | |
22 | print("Didn't store what I thought I stored."); | |
23 | throw "Error: array is in wierd state: " + result; | |
24 | } | |
25 | } | |
26 | ||
27 | for (var i = 0; i < 100000; ++i) { | |
28 | test(0); | |
29 | test(1); | |
30 | test(42); | |
31 | } |