Index: src/arm64/lithium-arm64.cc |
diff --git a/src/arm64/lithium-arm64.cc b/src/arm64/lithium-arm64.cc |
index adc2b5c916e47911c06fe4e62bf37e26eae1b15b..8682e2b82fc190cce90c98b6c2a01f7d1635b9fa 100644 |
--- a/src/arm64/lithium-arm64.cc |
+++ b/src/arm64/lithium-arm64.cc |
@@ -949,9 +949,16 @@ LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { |
LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
- LOperand* value = UseRegisterOrConstantAtStart(instr->index()); |
- LOperand* length = UseRegister(instr->length()); |
- return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); |
+ if (!FLAG_debug_code && instr->skip_check()) return NULL; |
+ LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
+ LOperand* length = !index->IsConstantOperand() |
+ ? UseRegisterOrConstantAtStart(instr->length()) |
+ : UseRegisterAtStart(instr->length()); |
+ LInstruction* result = new(zone()) LBoundsCheck(index, length); |
+ if (!FLAG_debug_code || !instr->skip_check()) { |
+ result = AssignEnvironment(result); |
+ } |
+ return result; |
} |