Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index c39f8a47fe604425dcd5a7f37b35f68bb985c63d..636ce8a557ef9fd866efe522ec1aead95ada38b9 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(), |
| @@ -5323,7 +5324,16 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
| Handle<JSObject> boilerplate = Handle<JSObject>::cast(raw_boilerplate); |
| ElementsKind boilerplate_elements_kind = |
| - Handle<JSObject>::cast(boilerplate)->GetElementsKind(); |
| + Handle<JSObject>::cast(boilerplate)->GetElementsKind(); |
| + |
| + // Heuristic: We only need to create allocation site info if the boilerplate |
| + // elements kind is the initial elements kind. |
|
Toon Verwaest
2013/01/16 10:53:42
This comment seems to belong above ::GetMode(Eleme
mvstanton
2013/01/16 13:01:56
Yep, indeed!
|
| + // |
| + // 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 = AllocationSiteInfo::GetMode( |
| + boilerplate_elements_kind); |
| // Check whether to use fast or slow deep-copying for boilerplate. |
| int total_size = 0; |
| @@ -5332,17 +5342,22 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
| HFastLiteral::kMaxLiteralDepth, |
| &max_properties, |
| &total_size)) { |
| + if (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, |
| length, |
| expr->literal_index(), |
| - expr->depth()); |
| + expr->depth(), |
| + mode); |
| } |
| // The array is expected in the bailout environment during computation |