Index: src/arm64/lithium-codegen-arm64.cc |
diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc |
index d91c2ca58f66547f0900568d37a888b4e3807977..78f46201a176c85baf419c8db39a3d6ed2889117 100644 |
--- a/src/arm64/lithium-codegen-arm64.cc |
+++ b/src/arm64/lithium-codegen-arm64.cc |
@@ -460,7 +460,15 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
DCHECK(ToRegister(instr->constructor()).is(x1)); |
__ Mov(x0, Operand(instr->arity())); |
- __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
+ if (instr->arity() == 1) { |
+ // We only need the allocation site for the case we have a length argument. |
+ // The case may bail out to the runtime, which will determine the correct |
+ // elements kind with the site. |
+ __ Mov(x2, instr->hydrogen()->site()); |
+ } else { |
+ __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
+ } |
+ |
ElementsKind kind = instr->hydrogen()->elements_kind(); |
AllocationSiteOverrideMode override_mode = |