Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Unified Diff: src/hydrogen.cc

Issue 1263773002: Pretenuring decision of outermost literal is propagated to inner literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 5e02c32cfb79d273e2f2a8c46c8fa155788f8195..ab037f3a3186c1986f2e4b40c4953f7e77bcc2c3 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -11429,16 +11429,20 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
HValue* object_size_constant = Add<HConstant>(initial_map->instance_size());
PretenureFlag pretenure_flag = NOT_TENURED;
- Handle<AllocationSite> current_site(*site_context->current(), isolate());
+ Handle<AllocationSite> 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<AllocationSite> 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<HAllocate>(
- 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<HConstant>(elements_size);
InstanceType instance_type = boilerplate_object->HasFastDoubleElements()
? FIXED_DOUBLE_ARRAY_TYPE : FIXED_ARRAY_TYPE;
- object_elements =
- Add<HAllocate>(object_elements_size, HType::HeapObject(),
- pretenure_flag, instance_type, current_site);
+ object_elements = Add<HAllocate>(object_elements_size, HType::HeapObject(),
+ pretenure_flag, instance_type, top_site);
BuildEmitElements(boilerplate_object, elements, object_elements,
site_context);
Add<HStoreNamedField>(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<HConstant>(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<HAllocate>(heap_number_constant, HType::HeapObject(),
pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698