| Index: src/mips/lithium-codegen-mips.cc
 | 
| diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
 | 
| index b173e30a2bc6075fa376b8182fd6aaac71c4d555..6c0f7cbf50ba00e1bea00e62628eebd329768d71 100644
 | 
| --- a/src/mips/lithium-codegen-mips.cc
 | 
| +++ b/src/mips/lithium-codegen-mips.cc
 | 
| @@ -4485,6 +4485,101 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
 | 
|  }
 | 
|  
 | 
|  
 | 
| +void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) {
 | 
| +  class DeferredMaybeGrowElements final : public LDeferredCode {
 | 
| +   public:
 | 
| +    DeferredMaybeGrowElements(LCodeGen* codegen, LMaybeGrowElements* instr)
 | 
| +        : LDeferredCode(codegen), instr_(instr) {}
 | 
| +    void Generate() override { codegen()->DoDeferredMaybeGrowElements(instr_); }
 | 
| +    LInstruction* instr() override { return instr_; }
 | 
| +
 | 
| +   private:
 | 
| +    LMaybeGrowElements* instr_;
 | 
| +  };
 | 
| +
 | 
| +  Register result = v0;
 | 
| +  DeferredMaybeGrowElements* deferred =
 | 
| +      new (zone()) DeferredMaybeGrowElements(this, instr);
 | 
| +  LOperand* key = instr->key();
 | 
| +  LOperand* current_capacity = instr->current_capacity();
 | 
| +
 | 
| +  DCHECK(instr->hydrogen()->key()->representation().IsInteger32());
 | 
| +  DCHECK(instr->hydrogen()->current_capacity()->representation().IsInteger32());
 | 
| +  DCHECK(key->IsConstantOperand() || key->IsRegister());
 | 
| +  DCHECK(current_capacity->IsConstantOperand() ||
 | 
| +         current_capacity->IsRegister());
 | 
| +
 | 
| +  if (key->IsConstantOperand() && current_capacity->IsConstantOperand()) {
 | 
| +    int32_t constant_key = ToInteger32(LConstantOperand::cast(key));
 | 
| +    int32_t constant_capacity =
 | 
| +        ToInteger32(LConstantOperand::cast(current_capacity));
 | 
| +    if (constant_key >= constant_capacity) {
 | 
| +      // Deferred case.
 | 
| +      __ jmp(deferred->entry());
 | 
| +    }
 | 
| +  } else if (key->IsConstantOperand()) {
 | 
| +    int32_t constant_key = ToInteger32(LConstantOperand::cast(key));
 | 
| +    __ Branch(deferred->entry(), le, ToRegister(current_capacity),
 | 
| +              Operand(constant_key));
 | 
| +  } else if (current_capacity->IsConstantOperand()) {
 | 
| +    int32_t constant_capacity =
 | 
| +        ToInteger32(LConstantOperand::cast(current_capacity));
 | 
| +    __ Branch(deferred->entry(), ge, ToRegister(key),
 | 
| +              Operand(constant_capacity));
 | 
| +  } else {
 | 
| +    __ Branch(deferred->entry(), ge, ToRegister(key),
 | 
| +              Operand(ToRegister(current_capacity)));
 | 
| +  }
 | 
| +
 | 
| +  if (instr->elements()->IsRegister()) {
 | 
| +    __ mov(result, ToRegister(instr->elements()));
 | 
| +  } else {
 | 
| +    __ lw(result, ToMemOperand(instr->elements()));
 | 
| +  }
 | 
| +
 | 
| +  __ bind(deferred->exit());
 | 
| +}
 | 
| +
 | 
| +
 | 
| +void LCodeGen::DoDeferredMaybeGrowElements(LMaybeGrowElements* instr) {
 | 
| +  // TODO(3095996): Get rid of this. For now, we need to make the
 | 
| +  // result register contain a valid pointer because it is already
 | 
| +  // contained in the register pointer map.
 | 
| +  Register result = v0;
 | 
| +  __ mov(result, zero_reg);
 | 
| +
 | 
| +  // We have to call a stub.
 | 
| +  {
 | 
| +    PushSafepointRegistersScope scope(this);
 | 
| +    if (instr->object()->IsRegister()) {
 | 
| +      __ mov(result, ToRegister(instr->object()));
 | 
| +    } else {
 | 
| +      __ lw(result, ToMemOperand(instr->object()));
 | 
| +    }
 | 
| +
 | 
| +    LOperand* key = instr->key();
 | 
| +    if (key->IsConstantOperand()) {
 | 
| +      __ li(a3, Operand(ToSmi(LConstantOperand::cast(key))));
 | 
| +    } else {
 | 
| +      __ mov(a3, ToRegister(key));
 | 
| +      __ SmiTag(a3);
 | 
| +    }
 | 
| +
 | 
| +    GrowArrayElementsStub stub(isolate(), instr->hydrogen()->is_js_array(),
 | 
| +                               instr->hydrogen()->kind());
 | 
| +    __ mov(a0, result);
 | 
| +    __ CallStub(&stub);
 | 
| +    RecordSafepointWithLazyDeopt(
 | 
| +        instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
 | 
| +    __ StoreToSafepointRegisterSlot(result, result);
 | 
| +  }
 | 
| +
 | 
| +  // Deoptimize if we got a smi back.
 | 
| +  __ SmiTst(result, at);
 | 
| +  DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg));
 | 
| +}
 | 
| +
 | 
| +
 | 
|  void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
 | 
|    Register object_reg = ToRegister(instr->object());
 | 
|    Register scratch = scratch0();
 | 
| 
 |