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

Side by Side Diff: src/hydrogen.cc

Issue 136703002: Handlify AllocationSite AddDependentCompilationInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 | « no previous file | src/objects.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 7889 matching lines...) Expand 10 before | Expand all | Expand 10 after
7900 7900
7901 void HOptimizedGraphBuilder::BuildInlinedCallNewArray(CallNew* expr) { 7901 void HOptimizedGraphBuilder::BuildInlinedCallNewArray(CallNew* expr) {
7902 NoObservableSideEffectsScope no_effects(this); 7902 NoObservableSideEffectsScope no_effects(this);
7903 7903
7904 int argument_count = expr->arguments()->length(); 7904 int argument_count = expr->arguments()->length();
7905 // We should at least have the constructor on the expression stack. 7905 // We should at least have the constructor on the expression stack.
7906 HValue* constructor = environment()->ExpressionStackAt(argument_count); 7906 HValue* constructor = environment()->ExpressionStackAt(argument_count);
7907 7907
7908 ElementsKind kind = expr->elements_kind(); 7908 ElementsKind kind = expr->elements_kind();
7909 Handle<Cell> cell = expr->allocation_info_cell(); 7909 Handle<Cell> cell = expr->allocation_info_cell();
7910 AllocationSite* site = AllocationSite::cast(cell->value()); 7910 Handle<AllocationSite> site(AllocationSite::cast(cell->value()));
7911 7911
7912 // Register on the site for deoptimization if the cell value changes. 7912 // Register on the site for deoptimization if the cell value changes.
7913 site->AddDependentCompilationInfo(AllocationSite::TRANSITIONS, top_info()); 7913 AllocationSite::AddDependentCompilationInfo(
7914 site, AllocationSite::TRANSITIONS, top_info());
7914 HInstruction* cell_instruction = Add<HConstant>(cell); 7915 HInstruction* cell_instruction = Add<HConstant>(cell);
7915 7916
7916 // In the single constant argument case, we may have to adjust elements kind 7917 // In the single constant argument case, we may have to adjust elements kind
7917 // to avoid creating a packed non-empty array. 7918 // to avoid creating a packed non-empty array.
7918 if (argument_count == 1 && !IsHoleyElementsKind(kind)) { 7919 if (argument_count == 1 && !IsHoleyElementsKind(kind)) {
7919 HValue* argument = environment()->Top(); 7920 HValue* argument = environment()->Top();
7920 if (argument->IsConstant()) { 7921 if (argument->IsConstant()) {
7921 HConstant* constant_argument = HConstant::cast(argument); 7922 HConstant* constant_argument = HConstant::cast(argument);
7922 ASSERT(constant_argument->HasSmiValue()); 7923 ASSERT(constant_argument->HasSmiValue());
7923 int constant_array_size = constant_argument->Integer32Value(); 7924 int constant_array_size = constant_argument->Integer32Value();
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
8918 // Inline the string addition into the stub when creating allocation 8919 // Inline the string addition into the stub when creating allocation
8919 // mementos to gather allocation site feedback. 8920 // mementos to gather allocation site feedback.
8920 if (graph()->info()->IsStub() && 8921 if (graph()->info()->IsStub() &&
8921 allocation_mode.CreateAllocationMementos()) { 8922 allocation_mode.CreateAllocationMementos()) {
8922 return BuildStringAdd(left, right, allocation_mode); 8923 return BuildStringAdd(left, right, allocation_mode);
8923 } 8924 }
8924 8925
8925 // Register the dependent code with the allocation site. 8926 // Register the dependent code with the allocation site.
8926 if (!allocation_mode.feedback_site().is_null()) { 8927 if (!allocation_mode.feedback_site().is_null()) {
8927 ASSERT(!graph()->info()->IsStub()); 8928 ASSERT(!graph()->info()->IsStub());
8928 allocation_mode.feedback_site()->AddDependentCompilationInfo( 8929 Handle<AllocationSite> site(allocation_mode.feedback_site());
8929 AllocationSite::TENURING, top_info()); 8930 AllocationSite::AddDependentCompilationInfo(
8931 site, AllocationSite::TENURING, top_info());
8930 } 8932 }
8931 8933
8932 // Inline string addition if we know that we'll create a cons string. 8934 // Inline string addition if we know that we'll create a cons string.
8933 if (left->IsConstant()) { 8935 if (left->IsConstant()) {
8934 HConstant* c_left = HConstant::cast(left); 8936 HConstant* c_left = HConstant::cast(left);
8935 if (c_left->HasStringValue()) { 8937 if (c_left->HasStringValue()) {
8936 int c_left_length = c_left->StringValue()->length(); 8938 int c_left_length = c_left->StringValue()->length();
8937 if (c_left_length == 0) { 8939 if (c_left_length == 0) {
8938 return right; 8940 return right;
8939 } else if (c_left_length + 1 >= ConsString::kMinLength) { 8941 } else if (c_left_length + 1 >= ConsString::kMinLength) {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
9495 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE); 9497 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE);
9496 9498
9497 HType type = instance_type == JS_ARRAY_TYPE 9499 HType type = instance_type == JS_ARRAY_TYPE
9498 ? HType::JSArray() : HType::JSObject(); 9500 ? HType::JSArray() : HType::JSObject();
9499 HValue* object_size_constant = Add<HConstant>( 9501 HValue* object_size_constant = Add<HConstant>(
9500 boilerplate_object->map()->instance_size()); 9502 boilerplate_object->map()->instance_size());
9501 9503
9502 PretenureFlag pretenure_flag = isolate()->heap()->GetPretenureMode(); 9504 PretenureFlag pretenure_flag = isolate()->heap()->GetPretenureMode();
9503 if (FLAG_allocation_site_pretenuring) { 9505 if (FLAG_allocation_site_pretenuring) {
9504 pretenure_flag = site_context->current()->GetPretenureMode(); 9506 pretenure_flag = site_context->current()->GetPretenureMode();
9505 site_context->current()->AddDependentCompilationInfo( 9507 Handle<AllocationSite> site(site_context->current());
9506 AllocationSite::TENURING, top_info()); 9508 AllocationSite::AddDependentCompilationInfo(
9509 site, AllocationSite::TENURING, top_info());
9507 } 9510 }
9508 9511
9509 HInstruction* object = Add<HAllocate>(object_size_constant, type, 9512 HInstruction* object = Add<HAllocate>(object_size_constant, type,
9510 pretenure_flag, instance_type, site_context->current()); 9513 pretenure_flag, instance_type, site_context->current());
9511 9514
9512 BuildEmitObjectHeader(boilerplate_object, object); 9515 BuildEmitObjectHeader(boilerplate_object, object);
9513 9516
9514 Handle<FixedArrayBase> elements(boilerplate_object->elements()); 9517 Handle<FixedArrayBase> elements(boilerplate_object->elements());
9515 int elements_size = (elements->length() > 0 && 9518 int elements_size = (elements->length() > 0 &&
9516 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? 9519 elements->map() != isolate()->heap()->fixed_cow_array_map()) ?
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
10972 if (ShouldProduceTraceOutput()) { 10975 if (ShouldProduceTraceOutput()) {
10973 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10976 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10974 } 10977 }
10975 10978
10976 #ifdef DEBUG 10979 #ifdef DEBUG
10977 graph_->Verify(false); // No full verify. 10980 graph_->Verify(false); // No full verify.
10978 #endif 10981 #endif
10979 } 10982 }
10980 10983
10981 } } // namespace v8::internal 10984 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698