Index: src/ast/ast.cc |
diff --git a/src/ast/ast.cc b/src/ast/ast.cc |
index d847f5449eecc2c300fdfea382a3ae67eb2332e1..fbc70c2abfaacf171fcea5b67b7c40beb7fa71b7 100644 |
--- a/src/ast/ast.cc |
+++ b/src/ast/ast.cc |
@@ -574,6 +574,14 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) { |
set_depth(depth_acc); |
} |
+bool ObjectLiteral::IsFastCloningSupported() const { |
+ // FastCloneShallowObjectStub doesn't copy elements, and object literals don't |
+ // support copy-on-write (COW) elements for now. |
+ // TODO(mvstanton): make object literals support COW elements. |
+ return fast_elements() && has_shallow_properties() && |
+ properties_count() <= |
+ FastCloneShallowObjectStub::kMaximumClonedProperties; |
+} |
void ArrayLiteral::BuildConstantElements(Isolate* isolate) { |
DCHECK_LT(first_spread_index_, 0); |
@@ -648,6 +656,11 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) { |
set_depth(depth_acc); |
} |
+bool ArrayLiteral::IsFastCloningSupported() const { |
+ return depth() <= 1 && |
+ values()->length() <= |
+ FastCloneShallowArrayStub::kMaximumClonedElements; |
+} |
void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate, |
FeedbackVectorSpec* spec, |