Index: src/arm64/lithium-codegen-arm64.cc |
diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc |
index a59120c76daf26878664091b3352ce89483e9a06..f8f06cfe8257a387c1b4f71990e1b90962f0c851 100644 |
--- a/src/arm64/lithium-codegen-arm64.cc |
+++ b/src/arm64/lithium-codegen-arm64.cc |
@@ -1775,36 +1775,25 @@ void LCodeGen::DoBitS(LBitS* instr) { |
} |
-void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { |
- if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
- __ Assert(InvertCondition(cc), kEliminatedBoundsCheckFailed); |
- } else { |
- DeoptimizeIf(cc, check->environment()); |
- } |
-} |
- |
- |
void LCodeGen::DoBoundsCheck(LBoundsCheck *instr) { |
- if (instr->hydrogen()->skip_check()) return; |
- |
+ Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
+ ASSERT(instr->hydrogen()->index()->representation().IsInteger32()); |
ASSERT(instr->hydrogen()->length()->representation().IsInteger32()); |
- Register length = ToRegister32(instr->length()); |
- |
if (instr->index()->IsConstantOperand()) { |
- int constant_index = |
- ToInteger32(LConstantOperand::cast(instr->index())); |
- |
- if (instr->hydrogen()->length()->representation().IsSmi()) { |
- __ Cmp(length, Smi::FromInt(constant_index)); |
- } else { |
- __ Cmp(length, constant_index); |
- } |
+ Operand index = ToOperand32I(instr->index()); |
+ Register length = ToRegister32(instr->length()); |
+ __ Cmp(length, index); |
+ cc = ReverseConditionForCmp(cc); |
} else { |
- ASSERT(instr->hydrogen()->index()->representation().IsInteger32()); |
- __ Cmp(length, ToRegister32(instr->index())); |
+ Register index = ToRegister32(instr->index()); |
+ Operand length = ToOperand32I(instr->length()); |
+ __ Cmp(index, length); |
+ } |
+ if (FLAG_debug_code && instr->hydrogen()->skip_check()) { |
+ __ Assert(InvertCondition(cc), kEliminatedBoundsCheckFailed); |
+ } else { |
+ DeoptimizeIf(cc, instr->environment()); |
} |
- Condition condition = instr->hydrogen()->allow_equality() ? lo : ls; |
- ApplyCheckIf(condition, instr); |
} |