X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4be4e30906bcb8ee30b4d189205cb70bad6707ce..81345200c95645a1b0d2635520f96ad55dfde63f:/tests/stress/array-push-contiguous.js diff --git a/tests/stress/array-push-contiguous.js b/tests/stress/array-push-contiguous.js new file mode 100644 index 0000000..8f5e285 --- /dev/null +++ b/tests/stress/array-push-contiguous.js @@ -0,0 +1,18 @@ +function foo() { + var array = []; + var result = []; + for (var i = 0; i < 42; ++i) + result.push(array.push("hello")); + return [array, result]; +} + +noInline(foo); + +for (var i = 0; i < 100000; ++i) { + var result = foo(); + if (result[0].toString() != "hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello,hello") + throw "Error: bad array: " + result[0]; + if (result[1].toString() != "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42") + throw "Error: bad array: " + result[1]; +} +