]>
Commit | Line | Data |
---|---|---|
81345200 A |
1 | function foo(x) { |
2 | return new Array(x); | |
3 | } | |
4 | ||
5 | noInline(foo); | |
6 | ||
7 | var poke; | |
8 | Array.prototype.__defineSetter__("1", function() { | |
9 | poke = "poke"; | |
10 | }); | |
11 | ||
12 | function test(size) { | |
13 | var result = foo(size); | |
14 | if (result.length != size) | |
15 | throw "Error: bad result: " + result; | |
16 | var sawThings = false; | |
17 | for (var s in result) { | |
18 | if (s != "1") | |
19 | sawThings = true; | |
20 | } | |
21 | if (sawThings) | |
22 | throw "Error: array is in bad state: " + result; | |
23 | result[0] = "42.5"; | |
24 | if (result[0] != "42.5") | |
25 | throw "Error: array is in wierd state: " + result; | |
26 | poke = null; | |
27 | result[1] = 42; | |
28 | if (poke != "poke") | |
29 | throw "Error: setter not called."; | |
30 | } | |
31 | ||
32 | for (var i = 0; i < 100000; ++i) { | |
33 | test(42); | |
34 | } |