X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/tests/stress/phantom-direct-arguments-clobber-argument-count.js diff --git a/tests/stress/phantom-direct-arguments-clobber-argument-count.js b/tests/stress/phantom-direct-arguments-clobber-argument-count.js new file mode 100644 index 0000000..eb50477 --- /dev/null +++ b/tests/stress/phantom-direct-arguments-clobber-argument-count.js @@ -0,0 +1,20 @@ +function foo() { + return effectful42.apply(this, arguments); +} + +function bar(a, b) { + var result = foo.apply(this, b); + return [a, a, a, a, a, a, a, a, result + a]; +} + +noInline(bar); + +for (var i = 0; i < 10000; ++i) { + var result = "" + bar(1, []); + if (result != "1,1,1,1,1,1,1,1,43") + throw "Error: bad result: " + result; +} + +var result = "" + bar(2147483647, []); +if (result != "2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483689") + throw "Error: bad result at end: " + result;