Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index d8742a6a4f9d342a941874ea44becc967ca688d9..0c2983f23e7c10e953084e2ccc85d885108b80d9 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -2546,20 +2546,21 @@ void LCodeGen::DoReturn(LReturn* instr) { |
if (NeedsEagerFrame()) { |
__ mov(sp, fp); |
__ Pop(ra, fp); |
- |
- if (instr->has_constant_parameter_count()) { |
- int parameter_count = ToInteger32(instr->constant_parameter_count()); |
- int32_t sp_delta = (parameter_count + 1) * kPointerSize; |
- if (sp_delta != 0) { |
- __ Addu(sp, sp, Operand(sp_delta)); |
- } |
- } else { |
- Register reg = ToRegister(instr->parameter_count()); |
- __ Addu(reg, reg, Operand(1)); |
- __ sll(at, reg, kPointerSizeLog2); |
- __ Addu(sp, sp, at); |
+ } |
+ if (instr->has_constant_parameter_count()) { |
+ int parameter_count = ToInteger32(instr->constant_parameter_count()); |
+ int32_t sp_delta = (parameter_count + 1) * kPointerSize; |
+ if (sp_delta != 0) { |
+ __ Addu(sp, sp, Operand(sp_delta)); |
} |
+ } else { |
+ Register reg = ToRegister(instr->parameter_count()); |
+ // The argument count parameter is a smi |
+ __ SmiUntag(reg); |
+ __ sll(at, reg, kPointerSizeLog2); |
+ __ Addu(sp, sp, at); |
} |
+ |
__ Jump(ra); |
} |
@@ -3890,10 +3891,18 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
__ li(a0, Operand(instr->arity())); |
__ li(a2, Operand(instr->hydrogen()->property_cell())); |
- Handle<Code> array_construct_code = |
- isolate()->builtins()->ArrayConstructCode(); |
- |
- CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); |
+ Object* cell_value = instr->hydrogen()->property_cell()->value(); |
+ ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
+ if (instr->arity() == 0) { |
+ ArrayNoArgumentConstructorStub stub(kind); |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ } else if (instr->arity() == 1) { |
+ ArraySingleArgumentConstructorStub stub(kind); |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ } else { |
+ ArrayNArgumentsConstructorStub stub(kind); |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ } |
} |