Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 0c3e5795391145d69106a18ed9485a9705df31e8..ee695e4f6d47893f9a677533ad137ba8a01b9784 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -4188,35 +4188,26 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
} |
-void LCodeGen::ApplyCheckIf(Condition condition, LBoundsCheck* check) { |
- if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
+void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
+ Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
+ if (instr->index()->IsConstantOperand()) { |
+ Operand index = ToOperand(instr->index()); |
+ Register length = ToRegister(instr->length()); |
+ __ cmp(length, index); |
+ cc = ReverseCondition(cc); |
+ } else { |
+ Register index = ToRegister(instr->index()); |
+ Operand length = ToOperand(instr->length()); |
+ __ cmp(index, length); |
+ } |
+ if (FLAG_debug_code && instr->hydrogen()->skip_check()) { |
Label done; |
- __ b(NegateCondition(condition), &done); |
+ __ b(NegateCondition(cc), &done); |
__ stop("eliminated bounds check failed"); |
__ bind(&done); |
} else { |
- DeoptimizeIf(condition, check->environment()); |
- } |
-} |
- |
- |
-void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
- if (instr->hydrogen()->skip_check()) return; |
- |
- if (instr->index()->IsConstantOperand()) { |
- int constant_index = |
- ToInteger32(LConstantOperand::cast(instr->index())); |
- if (instr->hydrogen()->length()->representation().IsSmi()) { |
- __ mov(ip, Operand(Smi::FromInt(constant_index))); |
- } else { |
- __ mov(ip, Operand(constant_index)); |
- } |
- __ cmp(ip, ToRegister(instr->length())); |
- } else { |
- __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); |
+ DeoptimizeIf(cc, instr->environment()); |
} |
- Condition condition = instr->hydrogen()->allow_equality() ? hi : hs; |
- ApplyCheckIf(condition, instr); |
} |