Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index 05fa79247e5fa6722fbe49f294c7a4ec10ca40ca..114eef7622f3e967e9ce0a0a9eeda9c870473c06 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -2047,11 +2047,23 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { |
Operand cmp_right = Operand(0); |
if (right->IsConstantOperand()) { |
- cmp_left = ToRegister(left); |
- cmp_right = Operand(ToInteger32(LConstantOperand::cast(right))); |
+ int32_t value = ToInteger32(LConstantOperand::cast(right)); |
+ if (instr->hydrogen_value()->representation().IsSmi()) { |
+ cmp_left = ToRegister(left); |
+ cmp_right = Operand(Smi::FromInt(value)); |
+ } else { |
+ cmp_left = ToRegister(left); |
+ cmp_right = Operand(value); |
+ } |
} else if (left->IsConstantOperand()) { |
- cmp_left = ToRegister(right); |
- cmp_right = Operand(ToInteger32(LConstantOperand::cast(left))); |
+ int32_t value = ToInteger32(LConstantOperand::cast(left)); |
+ if (instr->hydrogen_value()->representation().IsSmi()) { |
+ cmp_left = ToRegister(right); |
+ cmp_right = Operand(Smi::FromInt(value)); |
+ } else { |
+ cmp_left = ToRegister(right); |
+ cmp_right = Operand(value); |
+ } |
// We transposed the operands. Reverse the condition. |
cond = ReverseCondition(cond); |
} else { |