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

Side by Side 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, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 11411 matching lines...) Expand 10 before | Expand all | Expand 10 after
11422 NoObservableSideEffectsScope no_effects(this); 11422 NoObservableSideEffectsScope no_effects(this);
11423 Handle<Map> initial_map(boilerplate_object->map()); 11423 Handle<Map> initial_map(boilerplate_object->map());
11424 InstanceType instance_type = initial_map->instance_type(); 11424 InstanceType instance_type = initial_map->instance_type();
11425 DCHECK(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE); 11425 DCHECK(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE);
11426 11426
11427 HType type = instance_type == JS_ARRAY_TYPE 11427 HType type = instance_type == JS_ARRAY_TYPE
11428 ? HType::JSArray() : HType::JSObject(); 11428 ? HType::JSArray() : HType::JSObject();
11429 HValue* object_size_constant = Add<HConstant>(initial_map->instance_size()); 11429 HValue* object_size_constant = Add<HConstant>(initial_map->instance_size());
11430 11430
11431 PretenureFlag pretenure_flag = NOT_TENURED; 11431 PretenureFlag pretenure_flag = NOT_TENURED;
11432 Handle<AllocationSite> current_site(*site_context->current(), isolate()); 11432 Handle<AllocationSite> top_site(*site_context->top(), isolate());
11433 if (FLAG_allocation_site_pretenuring) { 11433 if (FLAG_allocation_site_pretenuring) {
11434 pretenure_flag = current_site->GetPretenureMode(); 11434 pretenure_flag = top_site->GetPretenureMode();
11435 top_info()->dependencies()->AssumeTenuringDecision(current_site);
11436 } 11435 }
11437 11436
11437 Handle<AllocationSite> current_site(*site_context->current(), isolate());
11438 if (*top_site == *current_site) {
11439 // We install a dependency for pretenuring only on the outermost literal.
11440 top_info()->dependencies()->AssumeTenuringDecision(top_site);
11441 }
11438 top_info()->dependencies()->AssumeTransitionStable(current_site); 11442 top_info()->dependencies()->AssumeTransitionStable(current_site);
11439 11443
11440 HInstruction* object = Add<HAllocate>( 11444 HInstruction* object = Add<HAllocate>(
11441 object_size_constant, type, pretenure_flag, instance_type, current_site); 11445 object_size_constant, type, pretenure_flag, instance_type, top_site);
11442 11446
11443 // If allocation folding reaches Page::kMaxRegularHeapObjectSize the 11447 // If allocation folding reaches Page::kMaxRegularHeapObjectSize the
11444 // elements array may not get folded into the object. Hence, we set the 11448 // elements array may not get folded into the object. Hence, we set the
11445 // elements pointer to empty fixed array and let store elimination remove 11449 // elements pointer to empty fixed array and let store elimination remove
11446 // this store in the folding case. 11450 // this store in the folding case.
11447 HConstant* empty_fixed_array = Add<HConstant>( 11451 HConstant* empty_fixed_array = Add<HConstant>(
11448 isolate()->factory()->empty_fixed_array()); 11452 isolate()->factory()->empty_fixed_array());
11449 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), 11453 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
11450 empty_fixed_array); 11454 empty_fixed_array);
11451 11455
(...skipping 19 matching lines...) Expand all
11471 isolate()->factory()->CopyAndTenureFixedCOWArray( 11475 isolate()->factory()->CopyAndTenureFixedCOWArray(
11472 Handle<FixedArray>::cast(elements))); 11476 Handle<FixedArray>::cast(elements)));
11473 boilerplate_object->set_elements(*elements); 11477 boilerplate_object->set_elements(*elements);
11474 } 11478 }
11475 11479
11476 HInstruction* object_elements = NULL; 11480 HInstruction* object_elements = NULL;
11477 if (elements_size > 0) { 11481 if (elements_size > 0) {
11478 HValue* object_elements_size = Add<HConstant>(elements_size); 11482 HValue* object_elements_size = Add<HConstant>(elements_size);
11479 InstanceType instance_type = boilerplate_object->HasFastDoubleElements() 11483 InstanceType instance_type = boilerplate_object->HasFastDoubleElements()
11480 ? FIXED_DOUBLE_ARRAY_TYPE : FIXED_ARRAY_TYPE; 11484 ? FIXED_DOUBLE_ARRAY_TYPE : FIXED_ARRAY_TYPE;
11481 object_elements = 11485 object_elements = Add<HAllocate>(object_elements_size, HType::HeapObject(),
11482 Add<HAllocate>(object_elements_size, HType::HeapObject(), 11486 pretenure_flag, instance_type, top_site);
11483 pretenure_flag, instance_type, current_site);
11484 BuildEmitElements(boilerplate_object, elements, object_elements, 11487 BuildEmitElements(boilerplate_object, elements, object_elements,
11485 site_context); 11488 site_context);
11486 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), 11489 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
11487 object_elements); 11490 object_elements);
11488 } else { 11491 } else {
11489 Handle<Object> elements_field = 11492 Handle<Object> elements_field =
11490 Handle<Object>(boilerplate_object->elements(), isolate()); 11493 Handle<Object>(boilerplate_object->elements(), isolate());
11491 HInstruction* object_elements_cow = Add<HConstant>(elements_field); 11494 HInstruction* object_elements_cow = Add<HConstant>(elements_field);
11492 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), 11495 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
11493 object_elements_cow); 11496 object_elements_cow);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
11574 BuildFastLiteral(value_object, site_context); 11577 BuildFastLiteral(value_object, site_context);
11575 site_context->ExitScope(current_site, value_object); 11578 site_context->ExitScope(current_site, value_object);
11576 Add<HStoreNamedField>(object, access, result); 11579 Add<HStoreNamedField>(object, access, result);
11577 } else { 11580 } else {
11578 Representation representation = details.representation(); 11581 Representation representation = details.representation();
11579 HInstruction* value_instruction; 11582 HInstruction* value_instruction;
11580 11583
11581 if (representation.IsDouble()) { 11584 if (representation.IsDouble()) {
11582 // Allocate a HeapNumber box and store the value into it. 11585 // Allocate a HeapNumber box and store the value into it.
11583 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); 11586 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize);
11584 // This heap number alloc does not have a corresponding
11585 // AllocationSite. That is okay because
11586 // 1) it's a child object of another object with a valid allocation site
11587 // 2) we can just use the mode of the parent object for pretenuring
11588 HInstruction* double_box = 11587 HInstruction* double_box =
11589 Add<HAllocate>(heap_number_constant, HType::HeapObject(), 11588 Add<HAllocate>(heap_number_constant, HType::HeapObject(),
11590 pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE); 11589 pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE);
11591 AddStoreMapConstant(double_box, 11590 AddStoreMapConstant(double_box,
11592 isolate()->factory()->mutable_heap_number_map()); 11591 isolate()->factory()->mutable_heap_number_map());
11593 // Unwrap the mutable heap number from the boilerplate. 11592 // Unwrap the mutable heap number from the boilerplate.
11594 HValue* double_value = 11593 HValue* double_value =
11595 Add<HConstant>(Handle<HeapNumber>::cast(value)->value()); 11594 Add<HConstant>(Handle<HeapNumber>::cast(value)->value());
11596 Add<HStoreNamedField>( 11595 Add<HStoreNamedField>(
11597 double_box, HObjectAccess::ForHeapNumberValue(), double_value); 11596 double_box, HObjectAccess::ForHeapNumberValue(), double_value);
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
13321 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13320 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13322 } 13321 }
13323 13322
13324 #ifdef DEBUG 13323 #ifdef DEBUG
13325 graph_->Verify(false); // No full verify. 13324 graph_->Verify(false); // No full verify.
13326 #endif 13325 #endif
13327 } 13326 }
13328 13327
13329 } // namespace internal 13328 } // namespace internal
13330 } // namespace v8 13329 } // namespace v8
OLDNEW
« 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