Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index d3d7b5837a0c5e3d9a09ba4a58ce9486773818e8..c7f86c85b1806e127592c91af283c40ed7908a29 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8216,12 +8216,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_pretenuring_call_new) { |
+ if (FLAG_allocation_site_pretenuring) { |
+ // Try to use pretenuring feedback. |
+ Handle<AllocationSite> allocation_site = expr->allocation_site(); |
+ if (!allocation_site.is_null()) { |
Hannes Payer (out of office)
2014/02/18 16:24:26
When is the allocation_site null?
mvstanton
2014/02/19 08:40:26
Wow. Never. Simplifying this. In the past it was m
|
+ allocation_mode = HAllocationMode(allocation_site); |
+ // Take a dependency on allocation site. |
+ AllocationSite::AddDependentCompilationInfo(allocation_site, |
+ AllocationSite::TENURING, |
+ top_info()); |
+ } |
+ } else { |
+ allocation_mode = HAllocationMode( |
+ isolate()->heap()->GetPretenureMode()); |
+ } |
+ } |
+ |
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. |