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

Side by Side Diff: src/hydrogen.cc

Issue 24255005: Some cleanup fixes (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 3 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.cc ('k') | src/ia32/code-stubs-ia32.cc » ('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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 if_nil.CaptureContinuation(continuation); 1817 if_nil.CaptureContinuation(continuation);
1818 } 1818 }
1819 1819
1820 1820
1821 HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object, 1821 HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object,
1822 int previous_object_size, 1822 int previous_object_size,
1823 HValue* alloc_site) { 1823 HValue* alloc_site) {
1824 ASSERT(alloc_site != NULL); 1824 ASSERT(alloc_site != NULL);
1825 HInnerAllocatedObject* alloc_memento = Add<HInnerAllocatedObject>( 1825 HInnerAllocatedObject* alloc_memento = Add<HInnerAllocatedObject>(
1826 previous_object, previous_object_size); 1826 previous_object, previous_object_size);
1827 Handle<Map> alloc_memento_map( 1827 Handle<Map> alloc_memento_map =
1828 isolate()->heap()->allocation_memento_map()); 1828 isolate()->factory()->allocation_memento_map();
1829 AddStoreMapConstant(alloc_memento, alloc_memento_map); 1829 AddStoreMapConstant(alloc_memento, alloc_memento_map);
1830 HObjectAccess access = HObjectAccess::ForAllocationMementoSite(); 1830 HObjectAccess access = HObjectAccess::ForAllocationMementoSite();
1831 Add<HStoreNamedField>(alloc_memento, access, alloc_site); 1831 Add<HStoreNamedField>(alloc_memento, access, alloc_site);
1832 return alloc_memento; 1832 return alloc_memento;
1833 } 1833 }
1834 1834
1835 1835
1836 HInstruction* HGraphBuilder::BuildGetNativeContext() { 1836 HInstruction* HGraphBuilder::BuildGetNativeContext() {
1837 // Get the global context, then the native context 1837 // Get the global context, then the native context
1838 HInstruction* global_object = Add<HGlobalObject>(); 1838 HInstruction* global_object = Add<HGlobalObject>();
(...skipping 2449 matching lines...) Expand 10 before | Expand all | Expand 10 after
4288 } 4288 }
4289 4289
4290 ASSERT(!raw_boilerplate.is_null()); 4290 ASSERT(!raw_boilerplate.is_null());
4291 ASSERT(site->IsLiteralSite()); 4291 ASSERT(site->IsLiteralSite());
4292 4292
4293 Handle<JSObject> boilerplate_object = 4293 Handle<JSObject> boilerplate_object =
4294 Handle<JSObject>::cast(raw_boilerplate); 4294 Handle<JSObject>::cast(raw_boilerplate);
4295 ElementsKind boilerplate_elements_kind = 4295 ElementsKind boilerplate_elements_kind =
4296 Handle<JSObject>::cast(boilerplate_object)->GetElementsKind(); 4296 Handle<JSObject>::cast(boilerplate_object)->GetElementsKind();
4297 4297
4298 // TODO(mvstanton): This heuristic is only a temporary solution. In the 4298 ASSERT(AllocationSite::CanTrack(boilerplate_object->map()->instance_type()));
4299 // end, we want to quit creating allocation site info after a certain number
4300 // of GCs for a call site.
4301 AllocationSiteMode mode = AllocationSite::GetMode(
4302 boilerplate_elements_kind);
4303 4299
4304 // Check whether to use fast or slow deep-copying for boilerplate. 4300 // Check whether to use fast or slow deep-copying for boilerplate.
4305 int max_properties = kMaxFastLiteralProperties; 4301 int max_properties = kMaxFastLiteralProperties;
4306 if (IsFastLiteral(boilerplate_object, 4302 if (IsFastLiteral(boilerplate_object,
4307 kMaxFastLiteralDepth, 4303 kMaxFastLiteralDepth,
4308 &max_properties)) { 4304 &max_properties)) {
4305 // TODO(mvstanton): This heuristic is only a temporary solution. In the
4306 // end, we want to quit creating allocation site info after a certain number
4307 // of GCs for a call site.
4308 AllocationSiteMode mode = AllocationSite::GetMode(
4309 boilerplate_elements_kind);
4310
4311 // it doesn't make sense to create allocation mementos if we are going to
4312 // create in old space.
4313 if (mode == TRACK_ALLOCATION_SITE &&
4314 isolate()->heap()->GetPretenureMode() == TENURED) {
4315 mode = DONT_TRACK_ALLOCATION_SITE;
4316 }
4317
4309 literal = BuildFastLiteral(boilerplate_object, 4318 literal = BuildFastLiteral(boilerplate_object,
4310 site, 4319 site,
4311 mode); 4320 mode);
4312 } else { 4321 } else {
4313 NoObservableSideEffectsScope no_effects(this); 4322 NoObservableSideEffectsScope no_effects(this);
4314 // Boilerplate already exists and constant elements are never accessed, 4323 // Boilerplate already exists and constant elements are never accessed,
4315 // pass an empty fixed array to the runtime function instead. 4324 // pass an empty fixed array to the runtime function instead.
4316 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array(); 4325 Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array();
4317 int literal_index = expr->literal_index(); 4326 int literal_index = expr->literal_index();
4318 4327
(...skipping 3792 matching lines...) Expand 10 before | Expand all | Expand 10 after
8111 Handle<JSObject> boilerplate_object, 8120 Handle<JSObject> boilerplate_object,
8112 Handle<Object> allocation_site_object, 8121 Handle<Object> allocation_site_object,
8113 AllocationSiteMode mode) { 8122 AllocationSiteMode mode) {
8114 NoObservableSideEffectsScope no_effects(this); 8123 NoObservableSideEffectsScope no_effects(this);
8115 8124
8116 Handle<FixedArrayBase> elements(boilerplate_object->elements()); 8125 Handle<FixedArrayBase> elements(boilerplate_object->elements());
8117 int object_size = boilerplate_object->map()->instance_size(); 8126 int object_size = boilerplate_object->map()->instance_size();
8118 int object_offset = object_size; 8127 int object_offset = object_size;
8119 8128
8120 InstanceType instance_type = boilerplate_object->map()->instance_type(); 8129 InstanceType instance_type = boilerplate_object->map()->instance_type();
8121 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && 8130 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE;
8122 AllocationSite::CanTrack(instance_type);
8123 8131
8124 // If using allocation sites, then the payload on the site should already 8132 // If using allocation sites, then
8125 // be filled in as a valid (boilerplate) array. 8133 // 1) the payload on the site should already be filled in as a valid
8134 // (boilerplate) array, and
8135 // 2) we shouldn't be pretenuring the allocations.
8126 ASSERT(!create_allocation_site_info || 8136 ASSERT(!create_allocation_site_info ||
8127 AllocationSite::cast(*allocation_site_object)->IsLiteralSite()); 8137 (AllocationSite::cast(*allocation_site_object)->IsLiteralSite() &&
8138 isolate()->heap()->GetPretenureMode() == NOT_TENURED));
8128 8139
8129 if (create_allocation_site_info) { 8140 if (create_allocation_site_info) {
8130 object_size += AllocationMemento::kSize; 8141 object_size += AllocationMemento::kSize;
8131 } 8142 }
8132 8143
8133 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE); 8144 ASSERT(instance_type == JS_ARRAY_TYPE || instance_type == JS_OBJECT_TYPE);
8134 HType type = instance_type == JS_ARRAY_TYPE 8145 HType type = instance_type == JS_ARRAY_TYPE
8135 ? HType::JSArray() : HType::JSObject(); 8146 ? HType::JSArray() : HType::JSObject();
8136 HValue* object_size_constant = Add<HConstant>(object_size); 8147 HValue* object_size_constant = Add<HConstant>(object_size);
8137 HInstruction* object = Add<HAllocate>(object_size_constant, type, 8148 HInstruction* object = Add<HAllocate>(object_size_constant, type,
8138 isolate()->heap()->GetPretenureMode(), instance_type); 8149 isolate()->heap()->GetPretenureMode(), instance_type);
8139 8150
8140
8141 BuildEmitObjectHeader(boilerplate_object, object); 8151 BuildEmitObjectHeader(boilerplate_object, object);
8142 8152
8143 if (create_allocation_site_info) { 8153 if (create_allocation_site_info) {
8144 HInstruction* allocation_site = Add<HConstant>(allocation_site_object); 8154 HInstruction* allocation_site = Add<HConstant>(allocation_site_object);
8145 BuildCreateAllocationMemento(object, object_offset, allocation_site); 8155 BuildCreateAllocationMemento(object, object_offset, allocation_site);
8146 } 8156 }
8147 8157
8148 int elements_size = (elements->length() > 0 && 8158 int elements_size = (elements->length() > 0 &&
8149 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? 8159 elements->map() != isolate()->heap()->fixed_cow_array_map()) ?
8150 elements->Size() : 0; 8160 elements->Size() : 0;
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
9621 if (ShouldProduceTraceOutput()) { 9631 if (ShouldProduceTraceOutput()) {
9622 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9632 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9623 } 9633 }
9624 9634
9625 #ifdef DEBUG 9635 #ifdef DEBUG
9626 graph_->Verify(false); // No full verify. 9636 graph_->Verify(false); // No full verify.
9627 #endif 9637 #endif
9628 } 9638 }
9629 9639
9630 } } // namespace v8::internal 9640 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698