Bug 834678 - Ensure correct update of lastPC_ for MInstructions which add OOL code. r=jandem

This commit is contained in:
Kannan Vijayan 2013-12-09 10:28:58 -05:00
parent ed772b9951
commit 73515ed307
10 changed files with 119 additions and 66 deletions

View File

@ -4307,8 +4307,8 @@ CodeGenerator::visitIsNullOrLikeUndefined(LIsNullOrLikeUndefined *lir)
bool bool
CodeGenerator::visitIsNullOrLikeUndefinedAndBranch(LIsNullOrLikeUndefinedAndBranch *lir) CodeGenerator::visitIsNullOrLikeUndefinedAndBranch(LIsNullOrLikeUndefinedAndBranch *lir)
{ {
JSOp op = lir->mir()->jsop(); JSOp op = lir->cmpMir()->jsop();
MCompare::CompareType compareType = lir->mir()->compareType(); MCompare::CompareType compareType = lir->cmpMir()->compareType();
JS_ASSERT(compareType == MCompare::Compare_Undefined || JS_ASSERT(compareType == MCompare::Compare_Undefined ||
compareType == MCompare::Compare_Null); compareType == MCompare::Compare_Null);
@ -4328,12 +4328,12 @@ CodeGenerator::visitIsNullOrLikeUndefinedAndBranch(LIsNullOrLikeUndefinedAndBran
op = JSOP_EQ; op = JSOP_EQ;
} }
MOZ_ASSERT(lir->mir()->lhs()->type() != MIRType_Object || MOZ_ASSERT(lir->cmpMir()->lhs()->type() != MIRType_Object ||
lir->mir()->operandMightEmulateUndefined(), lir->cmpMir()->operandMightEmulateUndefined(),
"Operands which can't emulate undefined should have been folded"); "Operands which can't emulate undefined should have been folded");
OutOfLineTestObject *ool = nullptr; OutOfLineTestObject *ool = nullptr;
if (lir->mir()->operandMightEmulateUndefined()) { if (lir->cmpMir()->operandMightEmulateUndefined()) {
ool = new(alloc()) OutOfLineTestObject(); ool = new(alloc()) OutOfLineTestObject();
if (!addOutOfLineCode(ool)) if (!addOutOfLineCode(ool))
return false; return false;
@ -4410,12 +4410,12 @@ CodeGenerator::visitEmulatesUndefined(LEmulatesUndefined *lir)
bool bool
CodeGenerator::visitEmulatesUndefinedAndBranch(LEmulatesUndefinedAndBranch *lir) CodeGenerator::visitEmulatesUndefinedAndBranch(LEmulatesUndefinedAndBranch *lir)
{ {
MOZ_ASSERT(lir->mir()->compareType() == MCompare::Compare_Undefined || MOZ_ASSERT(lir->cmpMir()->compareType() == MCompare::Compare_Undefined ||
lir->mir()->compareType() == MCompare::Compare_Null); lir->cmpMir()->compareType() == MCompare::Compare_Null);
MOZ_ASSERT(lir->mir()->operandMightEmulateUndefined(), MOZ_ASSERT(lir->cmpMir()->operandMightEmulateUndefined(),
"Operands which can't emulate undefined should have been folded"); "Operands which can't emulate undefined should have been folded");
JSOp op = lir->mir()->jsop(); JSOp op = lir->cmpMir()->jsop();
MOZ_ASSERT(op == JSOP_EQ || op == JSOP_NE, "Strict equality should have been folded"); MOZ_ASSERT(op == JSOP_EQ || op == JSOP_NE, "Strict equality should have been folded");
OutOfLineTestObject *ool = new(alloc()) OutOfLineTestObject(); OutOfLineTestObject *ool = new(alloc()) OutOfLineTestObject();

View File

@ -1649,13 +1649,15 @@ class LCompare : public LInstructionHelper<1, 2, 0>
// For objects, both operands are in registers. // For objects, both operands are in registers.
class LCompareAndBranch : public LControlInstructionHelper<2, 2, 0> class LCompareAndBranch : public LControlInstructionHelper<2, 2, 0>
{ {
MCompare *cmpMir_;
JSOp jsop_; JSOp jsop_;
public: public:
LIR_HEADER(CompareAndBranch) LIR_HEADER(CompareAndBranch)
LCompareAndBranch(JSOp jsop, const LAllocation &left, const LAllocation &right, LCompareAndBranch(MCompare *cmpMir, JSOp jsop,
const LAllocation &left, const LAllocation &right,
MBasicBlock *ifTrue, MBasicBlock *ifFalse) MBasicBlock *ifTrue, MBasicBlock *ifFalse)
: jsop_(jsop) : cmpMir_(cmpMir), jsop_(jsop)
{ {
setOperand(0, left); setOperand(0, left);
setOperand(1, right); setOperand(1, right);
@ -1678,8 +1680,11 @@ class LCompareAndBranch : public LControlInstructionHelper<2, 2, 0>
const LAllocation *right() { const LAllocation *right() {
return getOperand(1); return getOperand(1);
} }
MCompare *mir() { MTest *mir() const {
return mir_->toCompare(); return mir_->toTest();
}
MCompare *cmpMir() const {
return cmpMir_;
} }
const char *extraName() const { const char *extraName() const {
return js_CodeName[jsop_]; return js_CodeName[jsop_];
@ -1728,10 +1733,13 @@ class LCompareF : public LInstructionHelper<1, 2, 0>
class LCompareDAndBranch : public LControlInstructionHelper<2, 2, 0> class LCompareDAndBranch : public LControlInstructionHelper<2, 2, 0>
{ {
MCompare *cmpMir_;
public: public:
LIR_HEADER(CompareDAndBranch) LIR_HEADER(CompareDAndBranch)
LCompareDAndBranch(const LAllocation &left, const LAllocation &right, LCompareDAndBranch(MCompare *cmpMir, const LAllocation &left, const LAllocation &right,
MBasicBlock *ifTrue, MBasicBlock *ifFalse) MBasicBlock *ifTrue, MBasicBlock *ifFalse)
: cmpMir_(cmpMir)
{ {
setOperand(0, left); setOperand(0, left);
setOperand(1, right); setOperand(1, right);
@ -1751,17 +1759,23 @@ class LCompareDAndBranch : public LControlInstructionHelper<2, 2, 0>
const LAllocation *right() { const LAllocation *right() {
return getOperand(1); return getOperand(1);
} }
MCompare *mir() { MTest *mir() const {
return mir_->toCompare(); return mir_->toTest();
}
MCompare *cmpMir() const {
return cmpMir_;
} }
}; };
class LCompareFAndBranch : public LControlInstructionHelper<2, 2, 0> class LCompareFAndBranch : public LControlInstructionHelper<2, 2, 0>
{ {
MCompare *cmpMir_;
public: public:
LIR_HEADER(CompareFAndBranch) LIR_HEADER(CompareFAndBranch)
LCompareFAndBranch(const LAllocation &left, const LAllocation &right, LCompareFAndBranch(MCompare *cmpMir, const LAllocation &left, const LAllocation &right,
MBasicBlock *ifTrue, MBasicBlock *ifFalse) MBasicBlock *ifTrue, MBasicBlock *ifFalse)
: cmpMir_(cmpMir)
{ {
setOperand(0, left); setOperand(0, left);
setOperand(1, right); setOperand(1, right);
@ -1781,8 +1795,11 @@ class LCompareFAndBranch : public LControlInstructionHelper<2, 2, 0>
const LAllocation *right() { const LAllocation *right() {
return getOperand(1); return getOperand(1);
} }
MCompare *mir() { MTest *mir() const {
return mir_->toCompare(); return mir_->toTest();
}
MCompare *cmpMir() const {
return cmpMir_;
} }
}; };
@ -1864,10 +1881,14 @@ class LCompareB : public LInstructionHelper<1, BOX_PIECES + 1, 0>
class LCompareBAndBranch : public LControlInstructionHelper<2, BOX_PIECES + 1, 0> class LCompareBAndBranch : public LControlInstructionHelper<2, BOX_PIECES + 1, 0>
{ {
MCompare *cmpMir_;
public: public:
LIR_HEADER(CompareBAndBranch) LIR_HEADER(CompareBAndBranch)
LCompareBAndBranch(const LAllocation &rhs, MBasicBlock *ifTrue, MBasicBlock *ifFalse) LCompareBAndBranch(MCompare *cmpMir, const LAllocation &rhs,
MBasicBlock *ifTrue, MBasicBlock *ifFalse)
: cmpMir_(cmpMir)
{ {
setOperand(BOX_PIECES, rhs); setOperand(BOX_PIECES, rhs);
setSuccessor(0, ifTrue); setSuccessor(0, ifTrue);
@ -1886,8 +1907,11 @@ class LCompareBAndBranch : public LControlInstructionHelper<2, BOX_PIECES + 1, 0
MBasicBlock *ifFalse() const { MBasicBlock *ifFalse() const {
return getSuccessor(1); return getSuccessor(1);
} }
MCompare *mir() { MTest *mir() const {
return mir_->toCompare(); return mir_->toTest();
}
MCompare *cmpMir() const {
return cmpMir_;
} }
}; };
@ -1906,13 +1930,16 @@ class LCompareV : public LInstructionHelper<1, 2 * BOX_PIECES, 0>
class LCompareVAndBranch : public LControlInstructionHelper<2, 2 * BOX_PIECES, 0> class LCompareVAndBranch : public LControlInstructionHelper<2, 2 * BOX_PIECES, 0>
{ {
MCompare *cmpMir_;
public: public:
LIR_HEADER(CompareVAndBranch) LIR_HEADER(CompareVAndBranch)
static const size_t LhsInput = 0; static const size_t LhsInput = 0;
static const size_t RhsInput = BOX_PIECES; static const size_t RhsInput = BOX_PIECES;
LCompareVAndBranch(MBasicBlock *ifTrue, MBasicBlock *ifFalse) LCompareVAndBranch(MCompare *cmpMir, MBasicBlock *ifTrue, MBasicBlock *ifFalse)
: cmpMir_(cmpMir)
{ {
setSuccessor(0, ifTrue); setSuccessor(0, ifTrue);
setSuccessor(1, ifFalse); setSuccessor(1, ifFalse);
@ -1924,8 +1951,11 @@ class LCompareVAndBranch : public LControlInstructionHelper<2, 2 * BOX_PIECES, 0
MBasicBlock *ifFalse() const { MBasicBlock *ifFalse() const {
return getSuccessor(1); return getSuccessor(1);
} }
MCompare *mir() { MTest *mir() const {
return mir_->toCompare(); return mir_->toTest();
}
MCompare *cmpMir() const {
return cmpMir_;
} }
}; };
@ -1964,9 +1994,6 @@ class LBitAndAndBranch : public LControlInstructionHelper<2, 2, 0>
const LAllocation *right() { const LAllocation *right() {
return getOperand(1); return getOperand(1);
} }
MCompare *mir() {
return mir_->toCompare();
}
}; };
class LIsNullOrLikeUndefined : public LInstructionHelper<1, BOX_PIECES, 2> class LIsNullOrLikeUndefined : public LInstructionHelper<1, BOX_PIECES, 2>
@ -1997,10 +2024,14 @@ class LIsNullOrLikeUndefined : public LInstructionHelper<1, BOX_PIECES, 2>
class LIsNullOrLikeUndefinedAndBranch : public LControlInstructionHelper<2, BOX_PIECES, 2> class LIsNullOrLikeUndefinedAndBranch : public LControlInstructionHelper<2, BOX_PIECES, 2>
{ {
MCompare *cmpMir_;
public: public:
LIR_HEADER(IsNullOrLikeUndefinedAndBranch) LIR_HEADER(IsNullOrLikeUndefinedAndBranch)
LIsNullOrLikeUndefinedAndBranch(MBasicBlock *ifTrue, MBasicBlock *ifFalse, const LDefinition &temp, const LDefinition &tempToUnbox) LIsNullOrLikeUndefinedAndBranch(MCompare *cmpMir, MBasicBlock *ifTrue, MBasicBlock *ifFalse,
const LDefinition &temp, const LDefinition &tempToUnbox)
: cmpMir_(cmpMir)
{ {
setSuccessor(0, ifTrue); setSuccessor(0, ifTrue);
setSuccessor(1, ifFalse); setSuccessor(1, ifFalse);
@ -2016,8 +2047,11 @@ class LIsNullOrLikeUndefinedAndBranch : public LControlInstructionHelper<2, BOX_
MBasicBlock *ifFalse() const { MBasicBlock *ifFalse() const {
return getSuccessor(1); return getSuccessor(1);
} }
MCompare *mir() { MTest *mir() const {
return mir_->toCompare(); return mir_->toTest();
}
MCompare *cmpMir() const {
return cmpMir_;
} }
const LDefinition *temp() { const LDefinition *temp() {
return getTemp(0); return getTemp(0);
@ -2047,10 +2081,15 @@ class LEmulatesUndefined : public LInstructionHelper<1, 1, 0>
class LEmulatesUndefinedAndBranch : public LControlInstructionHelper<2, 1, 1> class LEmulatesUndefinedAndBranch : public LControlInstructionHelper<2, 1, 1>
{ {
MCompare *cmpMir_;
public: public:
LIR_HEADER(EmulatesUndefinedAndBranch) LIR_HEADER(EmulatesUndefinedAndBranch)
LEmulatesUndefinedAndBranch(const LAllocation &input, MBasicBlock *ifTrue, MBasicBlock *ifFalse, const LDefinition &temp) LEmulatesUndefinedAndBranch(MCompare *cmpMir, const LAllocation &input,
MBasicBlock *ifTrue, MBasicBlock *ifFalse,
const LDefinition &temp)
: cmpMir_(cmpMir)
{ {
setOperand(0, input); setOperand(0, input);
setSuccessor(0, ifTrue); setSuccessor(0, ifTrue);
@ -2064,8 +2103,11 @@ class LEmulatesUndefinedAndBranch : public LControlInstructionHelper<2, 1, 1>
MBasicBlock *ifFalse() const { MBasicBlock *ifFalse() const {
return getSuccessor(1); return getSuccessor(1);
} }
MCompare *mir() { MTest *mir() const {
return mir_->toCompare(); return mir_->toTest();
}
MCompare *cmpMir() const {
return cmpMir_;
} }
const LDefinition *temp() { const LDefinition *temp() {
return getTemp(0); return getTemp(0);

View File

@ -110,7 +110,7 @@ LIRGenerator::visitCheckOverRecursed(MCheckOverRecursed *ins)
{ {
LCheckOverRecursed *lir = new(alloc()) LCheckOverRecursed(); LCheckOverRecursed *lir = new(alloc()) LCheckOverRecursed();
if (!add(lir)) if (!add(lir, ins))
return false; return false;
if (!assignSafepoint(lir, ins)) if (!assignSafepoint(lir, ins))
return false; return false;
@ -736,8 +736,9 @@ LIRGenerator::visitTest(MTest *test)
"MCompare::tryFold should handle the never-emulates-undefined case"); "MCompare::tryFold should handle the never-emulates-undefined case");
LEmulatesUndefinedAndBranch *lir = LEmulatesUndefinedAndBranch *lir =
new(alloc()) LEmulatesUndefinedAndBranch(useRegister(left), ifTrue, ifFalse, temp()); new(alloc()) LEmulatesUndefinedAndBranch(comp, useRegister(left),
return add(lir, comp); ifTrue, ifFalse, temp());
return add(lir, test);
} }
LDefinition tmp, tmpToUnbox; LDefinition tmp, tmpToUnbox;
@ -750,10 +751,11 @@ LIRGenerator::visitTest(MTest *test)
} }
LIsNullOrLikeUndefinedAndBranch *lir = LIsNullOrLikeUndefinedAndBranch *lir =
new(alloc()) LIsNullOrLikeUndefinedAndBranch(ifTrue, ifFalse, tmp, tmpToUnbox); new(alloc()) LIsNullOrLikeUndefinedAndBranch(comp, ifTrue, ifFalse,
tmp, tmpToUnbox);
if (!useBox(lir, LIsNullOrLikeUndefinedAndBranch::Value, left)) if (!useBox(lir, LIsNullOrLikeUndefinedAndBranch::Value, left))
return false; return false;
return add(lir, comp); return add(lir, test);
} }
// Compare and branch booleans. // Compare and branch booleans.
@ -762,10 +764,10 @@ LIRGenerator::visitTest(MTest *test)
JS_ASSERT(right->type() == MIRType_Boolean); JS_ASSERT(right->type() == MIRType_Boolean);
LAllocation rhs = useRegisterOrConstant(right); LAllocation rhs = useRegisterOrConstant(right);
LCompareBAndBranch *lir = new(alloc()) LCompareBAndBranch(rhs, ifTrue, ifFalse); LCompareBAndBranch *lir = new(alloc()) LCompareBAndBranch(comp, rhs, ifTrue, ifFalse);
if (!useBox(lir, LCompareBAndBranch::Lhs, left)) if (!useBox(lir, LCompareBAndBranch::Lhs, left))
return false; return false;
return add(lir, comp); return add(lir, test);
} }
// Compare and branch Int32 or Object pointers. // Compare and branch Int32 or Object pointers.
@ -780,34 +782,37 @@ LIRGenerator::visitTest(MTest *test)
rhs = useAnyOrConstant(right); rhs = useAnyOrConstant(right);
else else
rhs = useRegister(right); rhs = useRegister(right);
LCompareAndBranch *lir = new(alloc()) LCompareAndBranch(op, lhs, rhs, ifTrue, ifFalse); LCompareAndBranch *lir = new(alloc()) LCompareAndBranch(comp, op, lhs, rhs,
return add(lir, comp); ifTrue, ifFalse);
return add(lir, test);
} }
// Compare and branch doubles. // Compare and branch doubles.
if (comp->isDoubleComparison()) { if (comp->isDoubleComparison()) {
LAllocation lhs = useRegister(left); LAllocation lhs = useRegister(left);
LAllocation rhs = useRegister(right); LAllocation rhs = useRegister(right);
LCompareDAndBranch *lir = new(alloc()) LCompareDAndBranch(lhs, rhs, ifTrue, ifFalse); LCompareDAndBranch *lir = new(alloc()) LCompareDAndBranch(comp, lhs, rhs,
return add(lir, comp); ifTrue, ifFalse);
return add(lir, test);
} }
// Compare and branch floats. // Compare and branch floats.
if (comp->isFloat32Comparison()) { if (comp->isFloat32Comparison()) {
LAllocation lhs = useRegister(left); LAllocation lhs = useRegister(left);
LAllocation rhs = useRegister(right); LAllocation rhs = useRegister(right);
LCompareFAndBranch *lir = new(alloc()) LCompareFAndBranch(lhs, rhs, ifTrue, ifFalse); LCompareFAndBranch *lir = new(alloc()) LCompareFAndBranch(comp, lhs, rhs,
return add(lir, comp); ifTrue, ifFalse);
return add(lir, test);
} }
// Compare values. // Compare values.
if (comp->compareType() == MCompare::Compare_Value) { if (comp->compareType() == MCompare::Compare_Value) {
LCompareVAndBranch *lir = new(alloc()) LCompareVAndBranch(ifTrue, ifFalse); LCompareVAndBranch *lir = new(alloc()) LCompareVAndBranch(comp, ifTrue, ifFalse);
if (!useBoxAtStart(lir, LCompareVAndBranch::LhsInput, left)) if (!useBoxAtStart(lir, LCompareVAndBranch::LhsInput, left))
return false; return false;
if (!useBoxAtStart(lir, LCompareVAndBranch::RhsInput, right)) if (!useBoxAtStart(lir, LCompareVAndBranch::RhsInput, right))
return false; return false;
return add(lir, comp); return add(lir, test);
} }
} }
@ -2080,12 +2085,12 @@ LIRGenerator::visitInterruptCheck(MInterruptCheck *ins)
#ifndef JS_CPU_ARM #ifndef JS_CPU_ARM
if (GetIonContext()->runtime->signalHandlersInstalled()) { if (GetIonContext()->runtime->signalHandlersInstalled()) {
LInterruptCheckImplicit *lir = new(alloc()) LInterruptCheckImplicit(); LInterruptCheckImplicit *lir = new(alloc()) LInterruptCheckImplicit();
return add(lir) && assignSafepoint(lir, ins); return add(lir, ins) && assignSafepoint(lir, ins);
} }
#endif #endif
LInterruptCheck *lir = new(alloc()) LInterruptCheck(); LInterruptCheck *lir = new(alloc()) LInterruptCheck();
return add(lir) && assignSafepoint(lir, ins); return add(lir, ins) && assignSafepoint(lir, ins);
} }
bool bool

View File

@ -1277,6 +1277,9 @@ class MTest
static MTest *New(TempAllocator &alloc, MDefinition *ins, static MTest *New(TempAllocator &alloc, MDefinition *ins,
MBasicBlock *ifTrue, MBasicBlock *ifFalse); MBasicBlock *ifTrue, MBasicBlock *ifFalse);
MDefinition *input() const {
return getOperand(0);
}
MBasicBlock *ifTrue() const { MBasicBlock *ifTrue() const {
return getSuccessor(0); return getSuccessor(0);
} }

View File

@ -134,7 +134,7 @@ CodeGeneratorARM::visitCompare(LCompare *comp)
bool bool
CodeGeneratorARM::visitCompareAndBranch(LCompareAndBranch *comp) CodeGeneratorARM::visitCompareAndBranch(LCompareAndBranch *comp)
{ {
Assembler::Condition cond = JSOpToCondition(comp->mir()->compareType(), comp->jsop()); Assembler::Condition cond = JSOpToCondition(comp->cmpMir()->compareType(), comp->jsop());
if (comp->right()->isConstant()) if (comp->right()->isConstant())
masm.ma_cmp(ToRegister(comp->left()), Imm32(ToInt32(comp->right()))); masm.ma_cmp(ToRegister(comp->left()), Imm32(ToInt32(comp->right())));
else else
@ -1460,7 +1460,7 @@ CodeGeneratorARM::visitCompareDAndBranch(LCompareDAndBranch *comp)
FloatRegister lhs = ToFloatRegister(comp->left()); FloatRegister lhs = ToFloatRegister(comp->left());
FloatRegister rhs = ToFloatRegister(comp->right()); FloatRegister rhs = ToFloatRegister(comp->right());
Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->mir()->jsop()); Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->cmpMir()->jsop());
masm.compareDouble(lhs, rhs); masm.compareDouble(lhs, rhs);
emitBranch(Assembler::ConditionFromDoubleCondition(cond), comp->ifTrue(), comp->ifFalse()); emitBranch(Assembler::ConditionFromDoubleCondition(cond), comp->ifTrue(), comp->ifFalse());
return true; return true;
@ -1472,7 +1472,7 @@ CodeGeneratorARM::visitCompareFAndBranch(LCompareFAndBranch *comp)
FloatRegister lhs = ToFloatRegister(comp->left()); FloatRegister lhs = ToFloatRegister(comp->left());
FloatRegister rhs = ToFloatRegister(comp->right()); FloatRegister rhs = ToFloatRegister(comp->right());
Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->mir()->jsop()); Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->cmpMir()->jsop());
masm.compareFloat(lhs, rhs); masm.compareFloat(lhs, rhs);
emitBranch(Assembler::ConditionFromDoubleCondition(cond), comp->ifTrue(), comp->ifFalse()); emitBranch(Assembler::ConditionFromDoubleCondition(cond), comp->ifTrue(), comp->ifFalse());
return true; return true;
@ -1512,7 +1512,7 @@ CodeGeneratorARM::visitCompareB(LCompareB *lir)
bool bool
CodeGeneratorARM::visitCompareBAndBranch(LCompareBAndBranch *lir) CodeGeneratorARM::visitCompareBAndBranch(LCompareBAndBranch *lir)
{ {
MCompare *mir = lir->mir(); MCompare *mir = lir->cmpMir();
const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs); const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs);
const LAllocation *rhs = lir->rhs(); const LAllocation *rhs = lir->rhs();
@ -1561,7 +1561,7 @@ CodeGeneratorARM::visitCompareV(LCompareV *lir)
bool bool
CodeGeneratorARM::visitCompareVAndBranch(LCompareVAndBranch *lir) CodeGeneratorARM::visitCompareVAndBranch(LCompareVAndBranch *lir)
{ {
MCompare *mir = lir->mir(); MCompare *mir = lir->cmpMir();
Assembler::Condition cond = JSOpToCondition(mir->compareType(), mir->jsop()); Assembler::Condition cond = JSOpToCondition(mir->compareType(), mir->jsop());
const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput); const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput);
const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput); const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput);

View File

@ -115,6 +115,7 @@ CodeGeneratorShared::addOutOfLineCode(OutOfLineCode *code)
code->setSource(oolIns->script(), oolIns->pc()); code->setSource(oolIns->script(), oolIns->pc());
else else
code->setSource(current ? current->mir()->info().script() : nullptr, lastPC_); code->setSource(current ? current->mir()->info().script() : nullptr, lastPC_);
JS_ASSERT_IF(code->script(), code->script()->containsPC(code->pc()));
return outOfLineCode_.append(code); return outOfLineCode_.append(code);
} }

View File

@ -180,7 +180,7 @@ CodeGeneratorX86Shared::visitCompare(LCompare *comp)
bool bool
CodeGeneratorX86Shared::visitCompareAndBranch(LCompareAndBranch *comp) CodeGeneratorX86Shared::visitCompareAndBranch(LCompareAndBranch *comp)
{ {
MCompare *mir = comp->mir(); MCompare *mir = comp->cmpMir();
emitCompare(mir->compareType(), comp->left(), comp->right()); emitCompare(mir->compareType(), comp->left(), comp->right());
Assembler::Condition cond = JSOpToCondition(mir->compareType(), comp->jsop()); Assembler::Condition cond = JSOpToCondition(mir->compareType(), comp->jsop());
emitBranch(cond, comp->ifTrue(), comp->ifFalse()); emitBranch(cond, comp->ifTrue(), comp->ifFalse());
@ -269,10 +269,10 @@ CodeGeneratorX86Shared::visitCompareDAndBranch(LCompareDAndBranch *comp)
FloatRegister lhs = ToFloatRegister(comp->left()); FloatRegister lhs = ToFloatRegister(comp->left());
FloatRegister rhs = ToFloatRegister(comp->right()); FloatRegister rhs = ToFloatRegister(comp->right());
Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->mir()->jsop()); Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->cmpMir()->jsop());
Assembler::NaNCond nanCond = Assembler::NaNCondFromDoubleCondition(cond); Assembler::NaNCond nanCond = Assembler::NaNCondFromDoubleCondition(cond);
if (comp->mir()->operandsAreNeverNaN()) if (comp->cmpMir()->operandsAreNeverNaN())
nanCond = Assembler::NaN_HandledByCond; nanCond = Assembler::NaN_HandledByCond;
masm.compareDouble(cond, lhs, rhs); masm.compareDouble(cond, lhs, rhs);
@ -286,10 +286,10 @@ CodeGeneratorX86Shared::visitCompareFAndBranch(LCompareFAndBranch *comp)
FloatRegister lhs = ToFloatRegister(comp->left()); FloatRegister lhs = ToFloatRegister(comp->left());
FloatRegister rhs = ToFloatRegister(comp->right()); FloatRegister rhs = ToFloatRegister(comp->right());
Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->mir()->jsop()); Assembler::DoubleCondition cond = JSOpToDoubleCondition(comp->cmpMir()->jsop());
Assembler::NaNCond nanCond = Assembler::NaNCondFromDoubleCondition(cond); Assembler::NaNCond nanCond = Assembler::NaNCondFromDoubleCondition(cond);
if (comp->mir()->operandsAreNeverNaN()) if (comp->cmpMir()->operandsAreNeverNaN())
nanCond = Assembler::NaN_HandledByCond; nanCond = Assembler::NaN_HandledByCond;
masm.compareFloat(cond, lhs, rhs); masm.compareFloat(cond, lhs, rhs);

View File

@ -446,8 +446,10 @@ LIRGeneratorShared::add(T *ins, MInstruction *mir)
{ {
JS_ASSERT(!ins->isPhi()); JS_ASSERT(!ins->isPhi());
current->add(ins); current->add(ins);
if (mir) if (mir) {
JS_ASSERT(current == mir->block()->lir());
ins->setMir(mir); ins->setMir(mir);
}
annotate(ins); annotate(ins);
return true; return true;
} }

View File

@ -313,7 +313,7 @@ CodeGeneratorX64::visitCompareB(LCompareB *lir)
bool bool
CodeGeneratorX64::visitCompareBAndBranch(LCompareBAndBranch *lir) CodeGeneratorX64::visitCompareBAndBranch(LCompareBAndBranch *lir)
{ {
MCompare *mir = lir->mir(); MCompare *mir = lir->cmpMir();
const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs); const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs);
const LAllocation *rhs = lir->rhs(); const LAllocation *rhs = lir->rhs();
@ -349,7 +349,7 @@ CodeGeneratorX64::visitCompareV(LCompareV *lir)
bool bool
CodeGeneratorX64::visitCompareVAndBranch(LCompareVAndBranch *lir) CodeGeneratorX64::visitCompareVAndBranch(LCompareVAndBranch *lir)
{ {
MCompare *mir = lir->mir(); MCompare *mir = lir->cmpMir();
const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput); const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput);
const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput); const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput);

View File

@ -310,7 +310,7 @@ CodeGeneratorX86::visitCompareB(LCompareB *lir)
bool bool
CodeGeneratorX86::visitCompareBAndBranch(LCompareBAndBranch *lir) CodeGeneratorX86::visitCompareBAndBranch(LCompareBAndBranch *lir)
{ {
MCompare *mir = lir->mir(); MCompare *mir = lir->cmpMir();
const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs); const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs);
const LAllocation *rhs = lir->rhs(); const LAllocation *rhs = lir->rhs();
@ -358,7 +358,7 @@ CodeGeneratorX86::visitCompareV(LCompareV *lir)
bool bool
CodeGeneratorX86::visitCompareVAndBranch(LCompareVAndBranch *lir) CodeGeneratorX86::visitCompareVAndBranch(LCompareVAndBranch *lir)
{ {
MCompare *mir = lir->mir(); MCompare *mir = lir->cmpMir();
Assembler::Condition cond = JSOpToCondition(mir->compareType(), mir->jsop()); Assembler::Condition cond = JSOpToCondition(mir->compareType(), mir->jsop());
const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput); const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput);
const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput); const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput);