Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index dddd1c68eb8131b32e7b39e8da92985526c29d65..2bbff86530b62b6c4c4bcf19b0121948810c6f2d 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2305,9 +2305,19 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { |
__ j(parity_even, chunk_->GetAssemblyLabel(false_block)); |
} else { |
if (right->IsConstantOperand()) { |
- __ cmp(ToRegister(left), ToInteger32Immediate(right)); |
+ int32_t const_value = ToInteger32(LConstantOperand::cast(right)); |
+ if (instr->hydrogen_value()->representation().IsSmi()) { |
+ __ cmp(ToOperand(left), Immediate(Smi::FromInt(const_value))); |
+ } else { |
+ __ cmp(ToOperand(left), Immediate(const_value)); |
+ } |
} else if (left->IsConstantOperand()) { |
- __ cmp(ToOperand(right), ToInteger32Immediate(left)); |
+ int32_t const_value = ToInteger32(LConstantOperand::cast(left)); |
+ if (instr->hydrogen_value()->representation().IsSmi()) { |
+ __ cmp(ToOperand(right), Immediate(Smi::FromInt(const_value))); |
+ } else { |
+ __ cmp(ToOperand(right), Immediate(const_value)); |
+ } |
// We transposed the operands. Reverse the condition. |
cc = ReverseCondition(cc); |
} else { |