Index: src/mips/lithium-mips.cc |
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc |
index a5fed5fa682d11929f9ba5d846cfad72602aafeb..0bfe7d2e269c6508f01bee9c8b8133c7b8601b57 100644 |
--- a/src/mips/lithium-mips.cc |
+++ b/src/mips/lithium-mips.cc |
@@ -1782,9 +1782,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; |
} |