]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/compare-eq-object-or-other-to-object.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / compare-eq-object-or-other-to-object.js
diff --git a/tests/stress/compare-eq-object-or-other-to-object.js b/tests/stress/compare-eq-object-or-other-to-object.js
new file mode 100644 (file)
index 0000000..a6e1e6d
--- /dev/null
@@ -0,0 +1,24 @@
+function foo(a, b) {
+    return a == b;
+}
+
+noInline(foo);
+
+function test(a, b, expected) {
+    var result = foo(a, b);
+    if (result != expected)
+        throw new Error("Unexpected result: " + result);
+}
+
+for (var i = 0; i < 100000; ++i) {
+    var o = {f:42};
+    var p = {g:43};
+    test(o, o, true);
+    test(o, p, false);
+    test(p, o, false);
+    test(p, p, true);
+    test(null, o, false);
+    test(null, p, false);
+    test(void 0, o, false);
+    test(void 0, p, false);
+}