Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 725cbb0c58701d26690626a7514551258055752e..4e89fb6abd87118fe0865bccf81c39086bea473a 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -1330,12 +1330,17 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
__ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
__ Push(Smi::FromInt(expr->literal_index())); |
__ Push(expr->constant_elements()); |
- if (expr->depth() > 1) { |
+ if (expr->constant_elements()->map() == Heap::fixed_cow_array_map()) { |
+ FastCloneShallowArrayStub stub( |
+ FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length); |
+ __ CallStub(&stub); |
+ } else if (expr->depth() > 1) { |
__ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
- } else if (length > FastCloneShallowArrayStub::kMaximumLength) { |
+ } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
__ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
} else { |
- FastCloneShallowArrayStub stub(length); |
+ FastCloneShallowArrayStub stub( |
+ FastCloneShallowArrayStub::CLONE_ELEMENTS, length); |
__ CallStub(&stub); |
} |