Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 837bbcd0a55d77c8b45b54053ba31326ef9aac2a..0cc8d16aab3210ddc42236c5486d85248d9f7943 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -4140,65 +4140,64 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
} |
-void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { |
- if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
- Label done; |
- __ j(NegateCondition(cc), &done, Label::kNear); |
- __ int3(); |
- __ bind(&done); |
- } else { |
- DeoptimizeIf(cc, check->environment()); |
- } |
-} |
- |
- |
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
- HBoundsCheck* hinstr = instr->hydrogen(); |
- if (hinstr->skip_check()) return; |
- |
- Representation representation = hinstr->length()->representation(); |
- ASSERT(representation.Equals(hinstr->index()->representation())); |
+ Representation representation = instr->hydrogen()->length()->representation(); |
+ ASSERT(representation.Equals(instr->hydrogen()->index()->representation())); |
ASSERT(representation.IsSmiOrInteger32()); |
- if (instr->length()->IsRegister()) { |
- Register reg = ToRegister(instr->length()); |
- |
- if (instr->index()->IsConstantOperand()) { |
- int32_t constant_index = |
- ToInteger32(LConstantOperand::cast(instr->index())); |
+ Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; |
+ if (instr->length()->IsConstantOperand()) { |
+ int32_t length = ToInteger32(LConstantOperand::cast(instr->length())); |
+ Register index = ToRegister(instr->index()); |
+ if (representation.IsSmi()) { |
+ __ Cmp(index, Smi::FromInt(length)); |
+ } else { |
+ __ cmpl(index, Immediate(length)); |
+ } |
+ cc = ReverseCondition(cc); |
+ } else if (instr->index()->IsConstantOperand()) { |
+ int32_t index = ToInteger32(LConstantOperand::cast(instr->index())); |
+ if (instr->length()->IsRegister()) { |
+ Register length = ToRegister(instr->length()); |
if (representation.IsSmi()) { |
- __ Cmp(reg, Smi::FromInt(constant_index)); |
+ __ Cmp(length, Smi::FromInt(index)); |
} else { |
- __ cmpl(reg, Immediate(constant_index)); |
+ __ cmpl(length, Immediate(index)); |
} |
} else { |
- Register reg2 = ToRegister(instr->index()); |
+ Operand length = ToOperand(instr->length()); |
if (representation.IsSmi()) { |
- __ cmpp(reg, reg2); |
+ __ Cmp(length, Smi::FromInt(index)); |
} else { |
- __ cmpl(reg, reg2); |
+ __ cmpl(length, Immediate(index)); |
} |
} |
} else { |
- Operand length = ToOperand(instr->length()); |
- if (instr->index()->IsConstantOperand()) { |
- int32_t constant_index = |
- ToInteger32(LConstantOperand::cast(instr->index())); |
+ Register index = ToRegister(instr->index()); |
+ if (instr->length()->IsRegister()) { |
+ Register length = ToRegister(instr->length()); |
if (representation.IsSmi()) { |
- __ Cmp(length, Smi::FromInt(constant_index)); |
+ __ cmpp(length, index); |
} else { |
- __ cmpl(length, Immediate(constant_index)); |
+ __ cmpl(length, index); |
} |
} else { |
+ Operand length = ToOperand(instr->length()); |
if (representation.IsSmi()) { |
- __ cmpp(length, ToRegister(instr->index())); |
+ __ cmpp(length, index); |
} else { |
- __ cmpl(length, ToRegister(instr->index())); |
+ __ cmpl(length, index); |
} |
} |
} |
- Condition condition = hinstr->allow_equality() ? below : below_equal; |
- ApplyCheckIf(condition, instr); |
+ if (FLAG_debug_code && instr->hydrogen()->skip_check()) { |
+ Label done; |
+ __ j(NegateCondition(cc), &done, Label::kNear); |
+ __ int3(); |
+ __ bind(&done); |
+ } else { |
+ DeoptimizeIf(cc, instr->environment()); |
+ } |
} |