Bug 1009967 - Add recover functionality for BitXor; r=nbp

This commit is contained in:
Inanc Seylan 2014-05-15 23:40:44 -07:00
parent 71e55c99d7
commit 5ced94863a
4 changed files with 63 additions and 0 deletions

View File

@ -50,6 +50,25 @@ function rbitor_object(i) {
return i;
}
var uceFault_bitxor_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_bitxor_number'));
function rbitxor_number(i) {
var x = 1 ^ i;
if (uceFault_bitxor_number(i) || uceFault_bitxor_number(i))
assertEq(x, 98 /* = 1 XOR 99 */);
return i;
}
var uceFault_bitxor_object = eval(uneval(uceFault).replace('uceFault', 'uceFault_bitxor_object'));
function rbitxor_object(i) {
var t = i;
var o = { valueOf: function () { return t; } };
var x = 1 ^ o; /* computed with t == i, not 1000 */
t = 1000;
if (uceFault_bitxor_object(i) || uceFault_bitxor_object(i))
assertEq(x, 98 /* = 1 XOR 99 */);
return i;
}
var uceFault_add_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_add_number'));
function radd_number(i) {
var x = 1 + i;

View File

@ -3536,6 +3536,11 @@ class MBitXor : public MBinaryBitwiseInstruction
return this;
}
void computeRange(TempAllocator &alloc);
bool writeRecoverData(CompactBufferWriter &writer) const;
bool canRecoverOnBailout() const {
return specialization_ < MIRType_Object;
}
};
class MShiftInstruction

View File

@ -197,6 +197,32 @@ RBitNot::recover(JSContext *cx, SnapshotIterator &iter) const
return true;
}
bool
MBitXor::writeRecoverData(CompactBufferWriter &writer) const
{
MOZ_ASSERT(canRecoverOnBailout());
writer.writeUnsigned(uint32_t(RInstruction::Recover_BitXor));
return true;
}
RBitXor::RBitXor(CompactBufferReader &reader)
{ }
bool
RBitXor::recover(JSContext *cx, SnapshotIterator &iter) const
{
RootedValue lhs(cx, iter.read());
RootedValue rhs(cx, iter.read());
int32_t result;
if (!js::BitXor(cx, lhs, rhs, &result))
return false;
RootedValue rootedResult(cx, js::Int32Value(result));
iter.storeInstructionResult(rootedResult);
return true;
}
bool
MNewObject::writeRecoverData(CompactBufferWriter &writer) const
{

View File

@ -20,6 +20,7 @@ namespace jit {
_(ResumePoint) \
_(BitNot) \
_(BitOr) \
_(BitXor) \
_(Add) \
_(NewObject) \
_(NewDerivedTypedObject)
@ -102,6 +103,18 @@ class RBitNot MOZ_FINAL : public RInstruction
bool recover(JSContext *cx, SnapshotIterator &iter) const;
};
class RBitXor MOZ_FINAL : public RInstruction
{
public:
RINSTRUCTION_HEADER_(BitXor)
virtual uint32_t numOperands() const {
return 2;
}
bool recover(JSContext *cx, SnapshotIterator &iter) const;
};
class RAdd MOZ_FINAL : public RInstruction
{
private: