Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 17afa48914d0e2968be902cb89a4073d5b507f17..e918f8ce6ef4f8a26f7881a90a9ed69a755c11c9 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -4092,7 +4092,14 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
DCHECK(ToRegister(instr->result()).is(r0)); |
__ mov(r0, Operand(instr->arity())); |
- __ LoadRoot(r2, 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. |
+ __ Move(r2, instr->hydrogen()->site()); |
+ } else { |
+ __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
+ } |
ElementsKind kind = instr->hydrogen()->elements_kind(); |
AllocationSiteOverrideMode override_mode = |
(AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |