diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/ion/bug717466.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
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 000000000..cd1b7b3e2 --- /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); +} + |