Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index e82e6e8da9b8f8ad63817e11f8cf7e4ecae7da07..5b13e3978332b3d0ac0b7277467958f33a745a7e 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -1789,9 +1789,16 @@ LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { |
LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
- LOperand* value = UseRegisterOrConstantAtStart(instr->index()); |
- LOperand* length = Use(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() |
+ ? UseOrConstantAtStart(instr->length()) |
+ : UseAtStart(instr->length()); |
+ LInstruction* result = new(zone()) LBoundsCheck(index, length); |
+ if (!FLAG_debug_code || !instr->skip_check()) { |
+ result = AssignEnvironment(result); |
+ } |
+ return result; |
} |