Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index b42e660d21090ca4e33f64b20651467cd2b044df..adbe64cb27fbec70d31ffd9029f2e0afd4572252 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -2074,16 +2074,32 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { |
int32_t value; |
if (right->IsConstantOperand()) { |
value = ToInteger32(LConstantOperand::cast(right)); |
- __ cmpl(ToRegister(left), Immediate(value)); |
+ if (instr->hydrogen_value()->representation().IsSmi()) { |
+ __ Cmp(ToRegister(left), Smi::FromInt(value)); |
+ } else { |
+ __ cmpl(ToRegister(left), Immediate(value)); |
+ } |
} else if (left->IsConstantOperand()) { |
value = ToInteger32(LConstantOperand::cast(left)); |
- if (right->IsRegister()) { |
+ if (instr->hydrogen_value()->representation().IsSmi()) { |
+ if (right->IsRegister()) { |
+ __ Cmp(ToRegister(right), Smi::FromInt(value)); |
+ } else { |
+ __ Cmp(ToOperand(right), Smi::FromInt(value)); |
+ } |
+ } else if (right->IsRegister()) { |
__ cmpl(ToRegister(right), Immediate(value)); |
} else { |
__ cmpl(ToOperand(right), Immediate(value)); |
} |
// We transposed the operands. Reverse the condition. |
cc = ReverseCondition(cc); |
+ } else if (instr->hydrogen_value()->representation().IsSmi()) { |
+ if (right->IsRegister()) { |
+ __ cmpq(ToRegister(left), ToRegister(right)); |
+ } else { |
+ __ cmpq(ToRegister(left), ToOperand(right)); |
+ } |
} else { |
if (right->IsRegister()) { |
__ cmpl(ToRegister(left), ToRegister(right)); |