]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/goofy-function-reentry-incorrect-inference.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / goofy-function-reentry-incorrect-inference.js
diff --git a/tests/stress/goofy-function-reentry-incorrect-inference.js b/tests/stress/goofy-function-reentry-incorrect-inference.js
new file mode 100644 (file)
index 0000000..a371347
--- /dev/null
@@ -0,0 +1,25 @@
+function foo(a) {
+    var x;
+    if (a)
+        x = a;
+    return [function() {
+        return x;
+    }, function(a) {
+        x = a;
+    }];
+}
+
+var array = foo(false);
+noInline(array[0]);
+noInline(array[1]);
+array[1](42);
+for (var i = 0; i < 10000; ++i) {
+    var result = array[0]();
+    if (result != 42)
+        throw "Error: bad result in loop: " + result;
+}
+
+array[1](43);
+var result = array[0]();
+if (result != 43)
+    throw "Error: bad result at end: " + result;