Index: src/crankshaft/mips/lithium-codegen-mips.cc |
diff --git a/src/crankshaft/mips/lithium-codegen-mips.cc b/src/crankshaft/mips/lithium-codegen-mips.cc |
index d3545b120b312fb06778bacdfaf190bf5877527b..20893e5aa268d278702886211b95bd3a80cbe47c 100644 |
--- a/src/crankshaft/mips/lithium-codegen-mips.cc |
+++ b/src/crankshaft/mips/lithium-codegen-mips.cc |
@@ -4020,13 +4020,19 @@ void LCodeGen::DoDeferredMaybeGrowElements(LMaybeGrowElements* instr) { |
if (Smi::IsValid(int_key)) { |
__ li(a3, Operand(Smi::FromInt(int_key))); |
} else { |
- // We should never get here at runtime because there is a smi check on |
- // the key before this point. |
- __ stop("expected smi"); |
+ Abort(kArrayIndexConstantValueTooBig); |
} |
} else { |
- __ mov(a3, ToRegister(key)); |
- __ SmiTag(a3); |
+ Label is_smi; |
+ __ SmiTagCheckOverflow(a3, ToRegister(key), at); |
+ // Deopt if the key is outside Smi range. The stub expects Smi and would |
+ // bump the elements into dictionary mode (and trigger a deopt) anyways. |
+ __ BranchOnNoOverflow(&is_smi, at); |
+ RestoreRegistersStateStub stub(isolate()); |
+ __ push(ra); |
+ __ CallStub(&stub); |
+ DeoptimizeIf(al, instr, DeoptimizeReason::kOverflow); |
+ __ bind(&is_smi); |
} |
GrowArrayElementsStub stub(isolate(), instr->hydrogen()->kind()); |