summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/bug717466.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/ion/bug717466.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--js/src/jit-test/tests/ion/bug717466.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/bug717466.js b/js/src/jit-test/tests/ion/bug717466.js
new file mode 100644
index 0000000000..cd1b7b3e2c
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug717466.js
@@ -0,0 +1,82 @@
+function Person(){}
+function Ninja(){}
+Ninja.prototype = new Person();
+function House(){}
+
+var empty = {};
+var person = new Person();
+var ninja = new Ninja();
+var house = new House();
+var string = new String();
+var bindNinja = Ninja.bind({});
+
+var array = {};
+array.__proto__ = Array.prototype;
+var array2 = {};
+array2.__proto__ = array.prototype;
+
+function test(v, v2) {
+ return v instanceof v2;
+}
+function test2(v, v2) {
+ return v instanceof v2;
+}
+function test3(v, v2) {
+ return v instanceof v2;
+}
+function test4(v, v2) {
+ return v instanceof v2;
+}
+
+// Test if specialized for object works
+for (var i=0; i!=41; i++) {
+ assertEq(test(person, Person), true);
+ assertEq(test(empty, Person), false);
+ assertEq(test(ninja, Person), true);
+ assertEq(test(house, Person), false);
+ assertEq(test(string, Person), false);
+ assertEq(test(new bindNinja(), Person), true);
+ assertEq(test(new Ninja(), bindNinja), true);
+ assertEq(test(string, String), true);
+ assertEq(test(array, Array), true);
+ assertEq(test(empty, Object), true);
+
+ // Test if bailout works
+ assertEq(test(0.1, Object), false);
+
+ // Should generate TypeError
+ var err = false;
+ try {
+ test(0.1, 5);
+ } catch (e) { err = true; }
+ assertEq(err, true);
+
+ // Should generate TypeError
+ var err = false;
+ try {
+ test(empty, empty);
+ } catch (e) { err = true; }
+ assertEq(err, true);
+
+ // Should generate TypeError
+ var err = false;
+ try {
+ test(5.0, empty);
+ } catch (e) { err = true; }
+ assertEq(err, true);
+}
+
+// Test if specialized for non-object lhs
+for (var i=0; i!=41; i++) {
+ assertEq(test2(0.1, Object), false);
+}
+
+// Check if we don't regress on https://bugzilla.mozilla.org/show_bug.cgi?id=7635
+function Foo() {};
+theproto = {};
+Foo.prototype = theproto;
+
+for (var i=0; i!=41; i++) {
+ assertEq(test3(theproto, Foo), false);
+}
+