Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index f3bcf1abc3fc1974af2b7bd55a8aeec35aec8269..0687e82550d37411f34fe2df806718bb84d1bfce 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -3681,8 +3681,14 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
if (instr->index()->IsConstantOperand()) { |
- __ cmp(ToOperand(instr->length()), |
- Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); |
+ int constant_index = |
+ ToInteger32(LConstantOperand::cast(instr->index())); |
+ if (instr->hydrogen()->length()->representation().IsTagged()) { |
+ __ cmp(ToOperand(instr->length()), |
+ Immediate(Smi::FromInt(constant_index))); |
+ } else { |
+ __ cmp(ToOperand(instr->length()), Immediate(constant_index)); |
+ } |
DeoptimizeIf(below_equal, instr->environment()); |
} else { |
__ cmp(ToRegister(instr->index()), ToOperand(instr->length())); |