]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/phantom-direct-arguments-clobber-argument-count.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / 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 (file)
index 0000000..eb50477
--- /dev/null
@@ -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;