Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index f286dacbe8d43366828c5dfad4651c6056cff07c..1c6d75e4966dab40b8ddb03ac84b38dde82ae452 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -5332,11 +5332,23 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
HFastLiteral::kMaxLiteralDepth, |
&max_properties, |
&total_size)) { |
+ // Heuristic: We only need to create allocation site info if the boilerplate |
+ // elements kind is the initial elements kind. |
+ // |
+ // TODO(mvstanton): This heuristic is only a temporary solution. In the |
+ // end, we want to quit creating allocation site info after a certain number |
+ // of GCs for a call site. |
+ bool create_allocation_site_info = FLAG_track_allocation_sites && |
+ IsFastSmiElementsKind(boilerplate_elements_kind); |
+ if (create_allocation_site_info) { |
+ total_size += AllocationSiteInfo::kSize; |
+ } |
literal = new(zone()) HFastLiteral(context, |
boilerplate, |
total_size, |
expr->literal_index(), |
- expr->depth()); |
+ expr->depth(), |
+ create_allocation_site_info); |
} else { |
literal = new(zone()) HArrayLiteral(context, |
boilerplate, |