Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 383cf3783f25892de0f195232babf6d1f697cd3c..695fae97bdf38099fc42e613e6957b3c941e1f9f 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -4025,44 +4025,51 @@ void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { |
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
- if (instr->hydrogen()->skip_check()) return; |
+ HBoundsCheck* hinstr = instr->hydrogen(); |
+ if (hinstr->skip_check()) return; |
+ |
+ Representation representation = hinstr->length()->representation(); |
+ ASSERT(representation.Equals(hinstr->index()->representation())); |
+ ASSERT(representation.IsSmiOrInteger32()); |
if (instr->length()->IsRegister()) { |
Register reg = ToRegister(instr->length()); |
- if (!instr->hydrogen()->length()->representation().IsSmi()) { |
- __ AssertZeroExtended(reg); |
- } |
+ |
if (instr->index()->IsConstantOperand()) { |
int32_t constant_index = |
ToInteger32(LConstantOperand::cast(instr->index())); |
- if (instr->hydrogen()->length()->representation().IsSmi()) { |
+ if (representation.IsSmi()) { |
__ Cmp(reg, Smi::FromInt(constant_index)); |
} else { |
- __ cmpq(reg, Immediate(constant_index)); |
+ __ cmpl(reg, Immediate(constant_index)); |
} |
} else { |
Register reg2 = ToRegister(instr->index()); |
- if (!instr->hydrogen()->index()->representation().IsSmi()) { |
- __ AssertZeroExtended(reg2); |
+ if (representation.IsSmi()) { |
+ __ cmpq(reg, reg2); |
+ } else { |
+ __ cmpl(reg, reg2); |
} |
- __ cmpq(reg, reg2); |
} |
} else { |
Operand length = ToOperand(instr->length()); |
if (instr->index()->IsConstantOperand()) { |
int32_t constant_index = |
ToInteger32(LConstantOperand::cast(instr->index())); |
- if (instr->hydrogen()->length()->representation().IsSmi()) { |
+ if (representation.IsSmi()) { |
__ Cmp(length, Smi::FromInt(constant_index)); |
} else { |
- __ cmpq(length, Immediate(constant_index)); |
+ __ cmpl(length, Immediate(constant_index)); |
} |
} else { |
- __ cmpq(length, ToRegister(instr->index())); |
+ if (representation.IsSmi()) { |
+ __ cmpq(length, ToRegister(instr->index())); |
+ } else { |
+ __ cmpl(length, ToRegister(instr->index())); |
+ } |
} |
} |
- Condition condition = |
- instr->hydrogen()->allow_equality() ? below : below_equal; |
+ Condition condition = hinstr->allow_equality() ? below : below_equal; |
ApplyCheckIf(condition, instr); |
} |