diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/jit-test/tests/ion/bug717466.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/ion/bug717466.js')
-rw-r--r-- | js/src/jit-test/tests/ion/bug717466.js | 82 |
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); +} + |