Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index f286dacbe8d43366828c5dfad4651c6056cff07c..4c7b47fbf46a8d4ee244c902f3770ec29f3d720a 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -5213,7 +5213,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
boilerplate_object, |
total_size, |
expr->literal_index(), |
- expr->depth()); |
+ expr->depth(), |
+ DONT_TRACK_ALLOCATION_SITE_INFO); |
} else { |
literal = new(zone()) HObjectLiteral(context, |
expr->constant_properties(), |
@@ -5332,11 +5333,24 @@ 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. |
+ AllocationSiteInfoMode mode = DONT_TRACK_ALLOCATION_SITE_INFO; |
+ if (FLAG_track_allocation_sites && |
+ IsFastSmiElementsKind(boilerplate_elements_kind)) { |
+ mode = TRACK_ALLOCATION_SITE_INFO; |
+ total_size += AllocationSiteInfo::kSize; |
+ } |
literal = new(zone()) HFastLiteral(context, |
boilerplate, |
total_size, |
expr->literal_index(), |
- expr->depth()); |
+ expr->depth(), |
+ mode); |
} else { |
literal = new(zone()) HArrayLiteral(context, |
boilerplate, |