diff --git a/js/src/jit-test/tests/ion/dce-with-rinstructions.js b/js/src/jit-test/tests/ion/dce-with-rinstructions.js index b4c9b5245fcb..1706787dd2b0 100644 --- a/js/src/jit-test/tests/ion/dce-with-rinstructions.js +++ b/js/src/jit-test/tests/ion/dce-with-rinstructions.js @@ -163,41 +163,6 @@ function radd_float(i) { return i; } -var uceFault_floor_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_floor_number')); -function rfloor_number(i) { - var x = Math.floor(i + 0.1111); - if (uceFault_floor_number(i) || uceFault_floor_number(i)) - assertEq(x, i); - return i; -} - -var uceFault_floor_object = eval(uneval(uceFault).replace('uceFault', 'uceFault_floor_object')); -function rfloor_object(i) { - var t = i + 0.1111; - var o = { valueOf: function () { return t; } }; - var x = Math.floor(o); - t = 1000.1111; - if (uceFault_floor_object(i) || uceFault_floor_object(i)) - assertEq(x, i); - return i; -} - -var uceFault_round_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_round')); -function rround_number(i) { - var x = Math.round(i + 1.4); - if (uceFault_round_number(i) || uceFault_round_number(i)) - assertEq(x, 100); /* = i + 1*/ - return i; -} - -var uceFault_round_double = eval(uneval(uceFault).replace('uceFault', 'uceFault_round_double')); -function rround_double(i) { - var x = Math.round(i + (-1 >>> 0)); - if (uceFault_round_double(i) || uceFault_round_double(i)) - assertEq(x, 99 + (-1 >>> 0)); /* = i + 2 ^ 32 - 1 */ - return i; - } - var uceFault_add_object = eval(uneval(uceFault).replace('uceFault', 'uceFault_add_object')); function radd_object(i) { var t = i; @@ -331,6 +296,41 @@ function rconcat_number(i) { return i; } +var uceFault_floor_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_floor_number')); +function rfloor_number(i) { + var x = Math.floor(i + 0.1111); + if (uceFault_floor_number(i) || uceFault_floor_number(i)) + assertEq(x, i); + return i; +} + +var uceFault_floor_object = eval(uneval(uceFault).replace('uceFault', 'uceFault_floor_object')); +function rfloor_object(i) { + var t = i + 0.1111; + var o = { valueOf: function () { return t; } }; + var x = Math.floor(o); + t = 1000.1111; + if (uceFault_floor_object(i) || uceFault_floor_object(i)) + assertEq(x, i); + return i; +} + +var uceFault_round_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_round')); +function rround_number(i) { + var x = Math.round(i + 1.4); + if (uceFault_round_number(i) || uceFault_round_number(i)) + assertEq(x, 100); /* = i + 1*/ + return i; +} + +var uceFault_round_double = eval(uneval(uceFault).replace('uceFault', 'uceFault_round_double')); +function rround_double(i) { + var x = Math.round(i + (-1 >>> 0)); + if (uceFault_round_double(i) || uceFault_round_double(i)) + assertEq(x, 99 + (-1 >>> 0)); /* = i + 2 ^ 32 - 1 */ + return i; + } + var uceFault_from_char_code = eval(uneval(uceFault).replace('uceFault', 'uceFault_from_char_code')); function rfrom_char_code(i) { var x = String.fromCharCode(i); diff --git a/js/src/jit/Recover.cpp b/js/src/jit/Recover.cpp index 98ba68d1a5b5..ce2df8857af5 100644 --- a/js/src/jit/Recover.cpp +++ b/js/src/jit/Recover.cpp @@ -391,57 +391,6 @@ RSub::recover(JSContext *cx, SnapshotIterator &iter) const return true; } -bool -MConcat::writeRecoverData(CompactBufferWriter &writer) const -{ - MOZ_ASSERT(canRecoverOnBailout()); - writer.writeUnsigned(uint32_t(RInstruction::Recover_Concat)); - return true; -} - -RConcat::RConcat(CompactBufferReader &reader) -{} - -bool -RConcat::recover(JSContext *cx, SnapshotIterator &iter) const -{ - RootedValue lhs(cx, iter.read()); - RootedValue rhs(cx, iter.read()); - RootedValue result(cx); - - MOZ_ASSERT(!lhs.isObject() && !rhs.isObject()); - if (!js::AddValues(cx, &lhs, &rhs, &result)) - return false; - - iter.storeInstructionResult(result); - return true; -} - -bool -MFromCharCode::writeRecoverData(CompactBufferWriter &writer) const -{ - MOZ_ASSERT(canRecoverOnBailout()); - writer.writeUnsigned(uint32_t(RInstruction::Recover_FromCharCode)); - return true; -} - -RFromCharCode::RFromCharCode(CompactBufferReader &reader) -{} - -bool -RFromCharCode::recover(JSContext *cx, SnapshotIterator &iter) const -{ - RootedValue operand(cx, iter.read()); - RootedValue result(cx); - - MOZ_ASSERT(!operand.isObject()); - if (!js::str_fromCharCode_one_arg(cx, operand, &result)) - return false; - - iter.storeInstructionResult(result); - return true; -} - bool MMul::writeRecoverData(CompactBufferWriter &writer) const { @@ -534,6 +483,32 @@ RMod::recover(JSContext *cx, SnapshotIterator &iter) const return true; } +bool +MConcat::writeRecoverData(CompactBufferWriter &writer) const +{ + MOZ_ASSERT(canRecoverOnBailout()); + writer.writeUnsigned(uint32_t(RInstruction::Recover_Concat)); + return true; +} + +RConcat::RConcat(CompactBufferReader &reader) +{} + +bool +RConcat::recover(JSContext *cx, SnapshotIterator &iter) const +{ + RootedValue lhs(cx, iter.read()); + RootedValue rhs(cx, iter.read()); + RootedValue result(cx); + + MOZ_ASSERT(!lhs.isObject() && !rhs.isObject()); + if (!js::AddValues(cx, &lhs, &rhs, &result)) + return false; + + iter.storeInstructionResult(result); + return true; +} + bool MFloor::writeRecoverData(CompactBufferWriter &writer) const { @@ -582,6 +557,31 @@ RRound::recover(JSContext *cx, SnapshotIterator &iter) const return true; } +bool +MFromCharCode::writeRecoverData(CompactBufferWriter &writer) const +{ + MOZ_ASSERT(canRecoverOnBailout()); + writer.writeUnsigned(uint32_t(RInstruction::Recover_FromCharCode)); + return true; +} + +RFromCharCode::RFromCharCode(CompactBufferReader &reader) +{} + +bool +RFromCharCode::recover(JSContext *cx, SnapshotIterator &iter) const +{ + RootedValue operand(cx, iter.read()); + RootedValue result(cx); + + MOZ_ASSERT(!operand.isObject()); + if (!js::str_fromCharCode_one_arg(cx, operand, &result)) + return false; + + iter.storeInstructionResult(result); + return true; +} + bool MPow::writeRecoverData(CompactBufferWriter &writer) const { diff --git a/js/src/jit/Recover.h b/js/src/jit/Recover.h index 4f4d6677cc9e..c71e62f3ccb9 100644 --- a/js/src/jit/Recover.h +++ b/js/src/jit/Recover.h @@ -219,18 +219,6 @@ class RSub MOZ_FINAL : public RInstruction bool recover(JSContext *cx, SnapshotIterator &iter) const; }; -class RMod MOZ_FINAL : public RInstruction -{ - public: - RINSTRUCTION_HEADER_(Mod) - - virtual uint32_t numOperands() const { - return 2; - } - - bool recover(JSContext *cx, SnapshotIterator &iter) const; -}; - class RMul MOZ_FINAL : public RInstruction { private: @@ -261,6 +249,18 @@ class RDiv MOZ_FINAL : public RInstruction bool recover(JSContext *cx, SnapshotIterator &iter) const; }; +class RMod MOZ_FINAL : public RInstruction +{ + public: + RINSTRUCTION_HEADER_(Mod) + + virtual uint32_t numOperands() const { + return 2; + } + + bool recover(JSContext *cx, SnapshotIterator &iter) const; +}; + class RConcat MOZ_FINAL : public RInstruction { public: