Index: src/x64/lithium-codegen-x64.cc |
=================================================================== |
--- src/x64/lithium-codegen-x64.cc (revision 10650) |
+++ src/x64/lithium-codegen-x64.cc (working copy) |
@@ -3232,17 +3232,25 @@ |
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
- if (instr->index()->IsConstantOperand()) { |
- if (instr->length()->IsRegister()) { |
- __ cmpq(ToRegister(instr->length()), |
+ if (instr->length()->IsRegister()) { |
+ Register reg = ToRegister(instr->length()); |
+ if (FLAG_debug_code) { |
+ __ AbortIfNotZeroExtended(reg); |
+ } |
+ if (instr->index()->IsConstantOperand()) { |
+ __ cmpq(reg, |
Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); |
} else { |
+ Register reg2 = ToRegister(instr->index()); |
+ if (FLAG_debug_code) { |
+ __ AbortIfNotZeroExtended(reg2); |
+ } |
+ __ cmpq(reg, reg2); |
+ } |
+ } else { |
+ if (instr->index()->IsConstantOperand()) { |
__ cmpq(ToOperand(instr->length()), |
Immediate(ToInteger32(LConstantOperand::cast(instr->index())))); |
- } |
- } else { |
- if (instr->length()->IsRegister()) { |
- __ cmpq(ToRegister(instr->length()), ToRegister(instr->index())); |
} else { |
__ cmpq(ToOperand(instr->length()), ToRegister(instr->index())); |
} |