Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 5e3e426042a63d8912827bd1f033fbe95370d174..dad70b3c33fe07cf7e448808a0ac36dac675e8d7 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -2556,6 +2556,8 @@ void LCodeGen::DoReturn(LReturn* instr) { |
rcx); |
} else { |
Register reg = ToRegister(instr->parameter_count()); |
+ // The argument count parameter is a smi |
+ __ SmiToInteger32(reg, reg); |
Register return_addr_reg = reg.is(rcx) ? rbx : rcx; |
__ pop(return_addr_reg); |
__ shl(reg, Immediate(kPointerSizeLog2)); |
@@ -3912,9 +3914,18 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
__ Set(rax, instr->arity()); |
__ Move(rbx, 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); |
+ } |
} |