Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index 380be11d893a244d22f714736f2b0514b9327785..aaca69f45bcb793d71d9dbff794571dd9b094ee5 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -3660,7 +3660,29 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
} |
+void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
+ HValue* value, |
+ LOperand* operand) { |
+ if (value->representation().IsTagged() && !value->type().IsSmi()) { |
+ if (operand->IsRegister()) { |
+ __ And(at, ToRegister(operand), Operand(kSmiTagMask)); |
+ DeoptimizeIf(ne, environment, at, Operand(zero_reg)); |
+ } else { |
+ __ li(at, ToOperand(operand)); |
+ __ And(at, at, Operand(kSmiTagMask)); |
+ DeoptimizeIf(ne, environment, at, Operand(zero_reg)); |
+ } |
+ } |
+} |
+ |
+ |
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
+ DeoptIfTaggedButNotSmi(instr->environment(), |
+ instr->hydrogen()->length(), |
+ instr->length()); |
+ DeoptIfTaggedButNotSmi(instr->environment(), |
+ instr->hydrogen()->index(), |
+ instr->index()); |
if (instr->index()->IsConstantOperand()) { |
int constant_index = |
ToInteger32(LConstantOperand::cast(instr->index())); |