Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 431643f24bf84705ba5fdaf8adcf676616807e93..1dd27ac9bd7c7cdde01f51f4ac63778fcd9c187e 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3923,8 +3923,26 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); |
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
} else if (instr->arity() == 1) { |
+ Label done; |
+ if (IsFastPackedElementsKind(kind)) { |
+ Label packed_case; |
+ // We might need a change here |
+ // look at the first argument |
+ __ movq(rcx, Operand(rsp, 0)); |
+ __ testq(rcx, rcx); |
+ __ j(zero, &packed_case); |
+ |
+ ElementsKind holey_kind = GetHoleyElementsKind(kind); |
+ ArraySingleArgumentConstructorStub stub(holey_kind, |
+ disable_allocation_sites); |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ __ jmp(&done); |
+ __ bind(&packed_case); |
+ } |
+ |
ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); |
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ __ bind(&done); |
} else { |
ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); |
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |