[JSC] Do not use asArrayModes() with Structures because it discards TypedArray inform...
[WebKit-https.git] / JSTests / stress / array-push-multiple-array-storage-beyond-int32.js
1 function shouldBe(actual, expected)
2 {
3     if (actual !== expected)
4         throw new Error('bad value: ' + actual);
5 }
6
7 function test(array, val1, val2)
8 {
9     return array.push(val1, val2);
10 }
11 noInline(test);
12
13 for (var i = 0; i < 1e5; ++i) {
14     var array = ["Cocoa"];
15     ensureArrayStorage(array);
16     array.length = 2;
17     shouldBe(test(array, "Cocoa", "Cappuccino"), 4);
18     shouldBe(array[0], "Cocoa");
19     shouldBe(array[1], undefined);
20     shouldBe(array[2], "Cocoa");
21     shouldBe(array[3], "Cappuccino");
22 }
23
24 var array = ["Cocoa"];
25 ensureArrayStorage(array);
26 array.length = 0x7fffffff - 1;
27 shouldBe(test(array, "Cocoa", "Cappuccino"), 0x7fffffff + 1);
28 shouldBe(array[0x7fffffff - 1], "Cocoa");
29 shouldBe(array[0x7fffffff - 0], "Cappuccino");