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

Side by Side Diff: src/hydrogen.cc

Issue 304493002: Remove global pretenuring mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/objects-inl.h » ('j') | 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 "hydrogen.h" 5 #include "hydrogen.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "v8.h" 9 #include "v8.h"
10 #include "allocation-site-scopes.h" 10 #include "allocation-site-scopes.h"
(...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 } 2286 }
2287 2287
2288 HConstant* elements_size_value = Add<HConstant>(elements_size); 2288 HConstant* elements_size_value = Add<HConstant>(elements_size);
2289 HValue* mul = AddUncasted<HMul>(capacity, elements_size_value); 2289 HValue* mul = AddUncasted<HMul>(capacity, elements_size_value);
2290 mul->ClearFlag(HValue::kCanOverflow); 2290 mul->ClearFlag(HValue::kCanOverflow);
2291 2291
2292 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize); 2292 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize);
2293 HValue* total_size = AddUncasted<HAdd>(mul, header_size); 2293 HValue* total_size = AddUncasted<HAdd>(mul, header_size);
2294 total_size->ClearFlag(HValue::kCanOverflow); 2294 total_size->ClearFlag(HValue::kCanOverflow);
2295 2295
2296 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? 2296 return Add<HAllocate>(total_size, HType::NonPrimitive(), NOT_TENURED,
2297 isolate()->heap()->GetPretenureMode() : NOT_TENURED; 2297 instance_type);
2298
2299 return Add<HAllocate>(total_size, HType::NonPrimitive(),
2300 pretenure_flag, instance_type);
2301 } 2298 }
2302 2299
2303 2300
2304 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, 2301 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements,
2305 ElementsKind kind, 2302 ElementsKind kind,
2306 HValue* capacity) { 2303 HValue* capacity) {
2307 Factory* factory = isolate()->factory(); 2304 Factory* factory = isolate()->factory();
2308 Handle<Map> map = IsFastDoubleElementsKind(kind) 2305 Handle<Map> map = IsFastDoubleElementsKind(kind)
2309 ? factory->fixed_double_array_map() 2306 ? factory->fixed_double_array_map()
2310 : factory->fixed_array_map(); 2307 : factory->fixed_array_map();
(...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after
5475 5472
5476 HStoreNamedField *instr; 5473 HStoreNamedField *instr;
5477 if (field_access.representation().IsDouble()) { 5474 if (field_access.representation().IsDouble()) {
5478 HObjectAccess heap_number_access = 5475 HObjectAccess heap_number_access =
5479 field_access.WithRepresentation(Representation::Tagged()); 5476 field_access.WithRepresentation(Representation::Tagged());
5480 if (transition_to_field) { 5477 if (transition_to_field) {
5481 // The store requires a mutable HeapNumber to be allocated. 5478 // The store requires a mutable HeapNumber to be allocated.
5482 NoObservableSideEffectsScope no_side_effects(this); 5479 NoObservableSideEffectsScope no_side_effects(this);
5483 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); 5480 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize);
5484 5481
5485 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? 5482 // TODO(hpayer): Allocation site pretenuring support.
5486 isolate()->heap()->GetPretenureMode() : NOT_TENURED;
5487
5488 HInstruction* heap_number = Add<HAllocate>(heap_number_size, 5483 HInstruction* heap_number = Add<HAllocate>(heap_number_size,
5489 HType::HeapNumber(), 5484 HType::HeapNumber(),
5490 pretenure_flag, 5485 NOT_TENURED,
5491 HEAP_NUMBER_TYPE); 5486 HEAP_NUMBER_TYPE);
5492 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); 5487 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map());
5493 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), 5488 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
5494 value); 5489 value);
5495 instr = New<HStoreNamedField>(checked_object->ActualValue(), 5490 instr = New<HStoreNamedField>(checked_object->ActualValue(),
5496 heap_number_access, 5491 heap_number_access,
5497 heap_number); 5492 heap_number);
5498 } else { 5493 } else {
5499 // Already holds a HeapNumber; load the box and write its value field. 5494 // Already holds a HeapNumber; load the box and write its value field.
5500 HInstruction* heap_number = Add<HLoadNamedField>( 5495 HInstruction* heap_number = Add<HLoadNamedField>(
(...skipping 3068 matching lines...) Expand 10 before | Expand all | Expand 10 after
8569 HAllocationMode allocation_mode; 8564 HAllocationMode allocation_mode;
8570 if (FLAG_pretenuring_call_new) { 8565 if (FLAG_pretenuring_call_new) {
8571 if (FLAG_allocation_site_pretenuring) { 8566 if (FLAG_allocation_site_pretenuring) {
8572 // Try to use pretenuring feedback. 8567 // Try to use pretenuring feedback.
8573 Handle<AllocationSite> allocation_site = expr->allocation_site(); 8568 Handle<AllocationSite> allocation_site = expr->allocation_site();
8574 allocation_mode = HAllocationMode(allocation_site); 8569 allocation_mode = HAllocationMode(allocation_site);
8575 // Take a dependency on allocation site. 8570 // Take a dependency on allocation site.
8576 AllocationSite::AddDependentCompilationInfo(allocation_site, 8571 AllocationSite::AddDependentCompilationInfo(allocation_site,
8577 AllocationSite::TENURING, 8572 AllocationSite::TENURING,
8578 top_info()); 8573 top_info());
8579 } else {
8580 allocation_mode = HAllocationMode(
8581 isolate()->heap()->GetPretenureMode());
8582 } 8574 }
8583 } 8575 }
8584 8576
8585 HAllocate* receiver = BuildAllocate( 8577 HAllocate* receiver = BuildAllocate(
8586 size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, allocation_mode); 8578 size_in_bytes, HType::JSObject(), JS_OBJECT_TYPE, allocation_mode);
8587 receiver->set_known_initial_map(initial_map); 8579 receiver->set_known_initial_map(initial_map);
8588 8580
8589 // Initialize map and fields of the newly allocated object. 8581 // Initialize map and fields of the newly allocated object.
8590 { NoObservableSideEffectsScope no_effects(this); 8582 { NoObservableSideEffectsScope no_effects(this);
8591 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE); 8583 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE);
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
9515 BinaryOperation* expr, 9507 BinaryOperation* expr,
9516 HValue* left, 9508 HValue* left,
9517 HValue* right, 9509 HValue* right,
9518 PushBeforeSimulateBehavior push_sim_result) { 9510 PushBeforeSimulateBehavior push_sim_result) {
9519 Type* left_type = expr->left()->bounds().lower; 9511 Type* left_type = expr->left()->bounds().lower;
9520 Type* right_type = expr->right()->bounds().lower; 9512 Type* right_type = expr->right()->bounds().lower;
9521 Type* result_type = expr->bounds().lower; 9513 Type* result_type = expr->bounds().lower;
9522 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); 9514 Maybe<int> fixed_right_arg = expr->fixed_right_arg();
9523 Handle<AllocationSite> allocation_site = expr->allocation_site(); 9515 Handle<AllocationSite> allocation_site = expr->allocation_site();
9524 9516
9525 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? 9517 HAllocationMode allocation_mode;
9526 isolate()->heap()->GetPretenureMode() : NOT_TENURED; 9518 if (FLAG_allocation_site_pretenuring && !allocation_site.is_null()) {
9527 9519 allocation_mode = HAllocationMode(allocation_site);
9528 HAllocationMode allocation_mode = 9520 }
9529 FLAG_allocation_site_pretenuring
9530 ? (allocation_site.is_null()
9531 ? HAllocationMode(NOT_TENURED)
9532 : HAllocationMode(allocation_site))
9533 : HAllocationMode(pretenure_flag);
9534 9521
9535 HValue* result = HGraphBuilder::BuildBinaryOperation( 9522 HValue* result = HGraphBuilder::BuildBinaryOperation(
9536 expr->op(), left, right, left_type, right_type, result_type, 9523 expr->op(), left, right, left_type, right_type, result_type,
9537 fixed_right_arg, allocation_mode); 9524 fixed_right_arg, allocation_mode);
9538 // Add a simulate after instructions with observable side effects, and 9525 // Add a simulate after instructions with observable side effects, and
9539 // after phis, which are the result of BuildBinaryOperation when we 9526 // after phis, which are the result of BuildBinaryOperation when we
9540 // inlined some complex subgraph. 9527 // inlined some complex subgraph.
9541 if (result->HasObservableSideEffects() || result->IsPhi()) { 9528 if (result->HasObservableSideEffects() || result->IsPhi()) {
9542 if (push_sim_result == PUSH_BEFORE_SIMULATE) { 9529 if (push_sim_result == PUSH_BEFORE_SIMULATE) {
9543 Push(result); 9530 Push(result);
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
10230 AllocationSiteUsageContext* site_context) { 10217 AllocationSiteUsageContext* site_context) {
10231 NoObservableSideEffectsScope no_effects(this); 10218 NoObservableSideEffectsScope no_effects(this);
10232 InstanceType instance_type = boilerplate_object->map()->instance_type(); 10219 InstanceType instance_type = boilerplate_object->map()->instance_type();
10233 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE); 10220 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE);
10234 10221
10235 HType type = instance_type == JS_ARRAY_TYPE 10222 HType type = instance_type == JS_ARRAY_TYPE
10236 ? HType::JSArray() : HType::JSObject(); 10223 ? HType::JSArray() : HType::JSObject();
10237 HValue* object_size_constant = Add<HConstant>( 10224 HValue* object_size_constant = Add<HConstant>(
10238 boilerplate_object->map()->instance_size()); 10225 boilerplate_object->map()->instance_size());
10239 10226
10240 PretenureFlag pretenure_flag = isolate()->heap()->GetPretenureMode(); 10227 PretenureFlag pretenure_flag = NOT_TENURED;
10241 if (FLAG_allocation_site_pretenuring) { 10228 if (FLAG_allocation_site_pretenuring) {
10242 pretenure_flag = site_context->current()->GetPretenureMode(); 10229 pretenure_flag = site_context->current()->GetPretenureMode();
10243 Handle<AllocationSite> site(site_context->current()); 10230 Handle<AllocationSite> site(site_context->current());
10244 AllocationSite::AddDependentCompilationInfo( 10231 AllocationSite::AddDependentCompilationInfo(
10245 site, AllocationSite::TENURING, top_info()); 10232 site, AllocationSite::TENURING, top_info());
10246 } 10233 }
10247 10234
10248 HInstruction* object = Add<HAllocate>(object_size_constant, type, 10235 HInstruction* object = Add<HAllocate>(object_size_constant, type,
10249 pretenure_flag, instance_type, site_context->current()); 10236 pretenure_flag, instance_type, site_context->current());
10250 10237
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
11796 if (ShouldProduceTraceOutput()) { 11783 if (ShouldProduceTraceOutput()) {
11797 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11784 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11798 } 11785 }
11799 11786
11800 #ifdef DEBUG 11787 #ifdef DEBUG
11801 graph_->Verify(false); // No full verify. 11788 graph_->Verify(false); // No full verify.
11802 #endif 11789 #endif
11803 } 11790 }
11804 11791
11805 } } // namespace v8::internal 11792 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698