Index: src/mips64/lithium-codegen-mips64.cc |
diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc |
index 40b3f1df5a976d5f90907bf4ba217f8364b73968..09ef2f5234426ed572a7f8be09b0ba27a8bccccf 100644 |
--- a/src/mips64/lithium-codegen-mips64.cc |
+++ b/src/mips64/lithium-codegen-mips64.cc |
@@ -4129,7 +4129,14 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
DCHECK(ToRegister(instr->result()).is(v0)); |
__ li(a0, Operand(instr->arity())); |
- __ LoadRoot(a2, 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. |
+ __ li(a2, instr->hydrogen()->site()); |
+ } else { |
+ __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
+ } |
ElementsKind kind = instr->hydrogen()->elements_kind(); |
AllocationSiteOverrideMode override_mode = |
(AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |