]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/new-array-with-size-with-bad-time.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / new-array-with-size-with-bad-time.js
CommitLineData
81345200
A
1function foo(x) {
2 return new Array(x);
3}
4
5noInline(foo);
6
7var poke;
8Array.prototype.__defineSetter__("1", function() {
9 poke = "poke";
10});
11
12function 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
32for (var i = 0; i < 100000; ++i) {
33 test(42);
34}