Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index b035ed1afa316f44037a8e4c7e12bb0d4c786896..b28ed3b4d61506dd5fe9c931bd8029d436ec9ad1 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -8237,12 +8237,27 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) { |
| // Allocate an instance of the implicit receiver object. |
| HValue* size_in_bytes = Add<HConstant>(instance_size); |
| - PretenureFlag pretenure_flag = |
| - (FLAG_pretenuring_call_new && !FLAG_allocation_site_pretenuring) ? |
| - isolate()->heap()->GetPretenureMode() : NOT_TENURED; |
| + HAllocationMode allocation_mode; |
| + if (!FLAG_allocation_site_pretenuring) { |
|
Hannes Payer (out of office)
2014/02/11 15:51:23
Can we re-order this combination of cases to:
if (
mvstanton
2014/02/17 15:53:08
very true, thx!
|
| + PretenureFlag pretenure_flag = FLAG_pretenuring_call_new |
| + ? isolate()->heap()->GetPretenureMode() |
| + : NOT_TENURED; |
| + allocation_mode = HAllocationMode(pretenure_flag); |
| + } else if (FLAG_pretenuring_call_new) { |
| + // Try to use pretenuring feedback. |
| + Handle<AllocationSite> allocation_site = expr->allocation_site(); |
| + if (!allocation_site.is_null()) { |
| + allocation_mode = HAllocationMode(allocation_site); |
| + // Take a dependency on allocation site. |
| + AllocationSite::AddDependentCompilationInfo(allocation_site, |
| + AllocationSite::TENURING, |
| + top_info()); |
| + } |
| + } |
| + |
| HAllocate* receiver = |
| - Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag, |
| - JS_OBJECT_TYPE); |
| + BuildAllocate(size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, |
| + allocation_mode); |
| receiver->set_known_initial_map(initial_map); |
| // Load the initial map from the constructor. |