Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 3e688dfd004c7bc4aa29dfa2637ce62ba6203bc4..0d8bf77cd1b4da9aafd093d6d039057bb25ebe26 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3617,8 +3617,13 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
__ AbortIfNotZeroExtended(reg); |
} |
if (instr->index()->IsConstantOperand()) { |
- __ cmpq(reg, |
- Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); |
+ int constant_index = |
+ ToInteger32(LConstantOperand::cast(instr->index())); |
+ if (instr->hydrogen()->length()->representation().IsTagged()) { |
+ __ Cmp(reg, Smi::FromInt(constant_index)); |
+ } else { |
+ __ cmpq(reg, Immediate(constant_index)); |
+ } |
} else { |
Register reg2 = ToRegister(instr->index()); |
if (FLAG_debug_code && |