Index: src/arm/lithium-arm.cc |
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc |
index 357c191d817dd209487ff01bbaba11fee55f7761..79a5cd546bca0e66efa1ad81ba3dbaf304df2c1a 100644 |
--- a/src/arm/lithium-arm.cc |
+++ b/src/arm/lithium-arm.cc |
@@ -1830,9 +1830,16 @@ LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* 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; |
} |