From aa84551622799c6c44b8ee60ea6c40405465177a Mon Sep 17 00:00:00 2001 From: Hannes Payer Date: Wed, 29 Jul 2015 11:56:21 +0200 Subject: [PATCH] Pretenuring decision of outermost literal is propagated to inner literals. Literals should stay together to simplify allocation folding. This CL takes the pretenuring information from the outermost literal and applies it to the inner liberals. BUG=chromium:514721 LOG=n R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/1263773002 . Cr-Commit-Position: refs/heads/master@{#29903} --- src/hydrogen.cc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 5e02c32..ab037f3 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -11429,16 +11429,20 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( HValue* object_size_constant = Add(initial_map->instance_size()); PretenureFlag pretenure_flag = NOT_TENURED; - Handle current_site(*site_context->current(), isolate()); + Handle top_site(*site_context->top(), isolate()); if (FLAG_allocation_site_pretenuring) { - pretenure_flag = current_site->GetPretenureMode(); - top_info()->dependencies()->AssumeTenuringDecision(current_site); + pretenure_flag = top_site->GetPretenureMode(); } + Handle current_site(*site_context->current(), isolate()); + if (*top_site == *current_site) { + // We install a dependency for pretenuring only on the outermost literal. + top_info()->dependencies()->AssumeTenuringDecision(top_site); + } top_info()->dependencies()->AssumeTransitionStable(current_site); HInstruction* object = Add( - object_size_constant, type, pretenure_flag, instance_type, current_site); + object_size_constant, type, pretenure_flag, instance_type, top_site); // If allocation folding reaches Page::kMaxRegularHeapObjectSize the // elements array may not get folded into the object. Hence, we set the @@ -11478,9 +11482,8 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral( HValue* object_elements_size = Add(elements_size); InstanceType instance_type = boilerplate_object->HasFastDoubleElements() ? FIXED_DOUBLE_ARRAY_TYPE : FIXED_ARRAY_TYPE; - object_elements = - Add(object_elements_size, HType::HeapObject(), - pretenure_flag, instance_type, current_site); + object_elements = Add(object_elements_size, HType::HeapObject(), + pretenure_flag, instance_type, top_site); BuildEmitElements(boilerplate_object, elements, object_elements, site_context); Add(object, HObjectAccess::ForElementsPointer(), @@ -11581,10 +11584,6 @@ void HOptimizedGraphBuilder::BuildEmitInObjectProperties( if (representation.IsDouble()) { // Allocate a HeapNumber box and store the value into it. HValue* heap_number_constant = Add(HeapNumber::kSize); - // This heap number alloc does not have a corresponding - // AllocationSite. That is okay because - // 1) it's a child object of another object with a valid allocation site - // 2) we can just use the mode of the parent object for pretenuring HInstruction* double_box = Add(heap_number_constant, HType::HeapObject(), pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE); -- 2.7.4