]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/fold-based-on-int32-proof-mul-branch.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / fold-based-on-int32-proof-mul-branch.js
diff --git a/tests/stress/fold-based-on-int32-proof-mul-branch.js b/tests/stress/fold-based-on-int32-proof-mul-branch.js
new file mode 100644 (file)
index 0000000..4d1883d
--- /dev/null
@@ -0,0 +1,17 @@
+function foo(a, b) {
+    var value = DFGTrue() ? -0 : "foo";
+    if (a * b == value)
+        return [DFGTrue(), true];
+    return [DFGTrue(), false];
+}
+noInline(foo);
+
+for (var i = 0; i < 10000; ++i) {
+    var result = foo(1, 1);
+    if (result[1] !== false)
+        throw "Error: bad result: " + result;
+}
+
+var result = foo(-1, 0);
+if (result[1] !== true && result[0])
+    throw "Error: bad result at end: " + result;