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

Side by Side Diff: src/hydrogen.cc

Issue 197473004: Pretenure code generation corner case with new space COW arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 6 years, 9 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') | 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 // 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 9739 matching lines...) Expand 10 before | Expand all | Expand 10 after
9750 HInstruction* object = Add<HAllocate>(object_size_constant, type, 9750 HInstruction* object = Add<HAllocate>(object_size_constant, type,
9751 pretenure_flag, instance_type, site_context->current()); 9751 pretenure_flag, instance_type, site_context->current());
9752 9752
9753 BuildEmitObjectHeader(boilerplate_object, object); 9753 BuildEmitObjectHeader(boilerplate_object, object);
9754 9754
9755 Handle<FixedArrayBase> elements(boilerplate_object->elements()); 9755 Handle<FixedArrayBase> elements(boilerplate_object->elements());
9756 int elements_size = (elements->length() > 0 && 9756 int elements_size = (elements->length() > 0 &&
9757 elements->map() != isolate()->heap()->fixed_cow_array_map()) ? 9757 elements->map() != isolate()->heap()->fixed_cow_array_map()) ?
9758 elements->Size() : 0; 9758 elements->Size() : 0;
9759 9759
9760 if (pretenure_flag == TENURED &&
9761 elements->map() == isolate()->heap()->fixed_cow_array_map() &&
9762 isolate()->heap()->InNewSpace(*elements)) {
9763 // If we would like to pretenure a fixed cow array, we must ensure that the
9764 // array is already in old space, otherwise we'll create too many old-to-
9765 // new-space pointers (overflowing the store buffer).
9766 elements = Handle<FixedArrayBase>(
9767 isolate()->factory()->CopyAndTenureFixedCOWArray(
9768 Handle<FixedArray>::cast(elements)));
9769 boilerplate_object->set_elements(*elements);
9770 }
9771
9760 HInstruction* object_elements = NULL; 9772 HInstruction* object_elements = NULL;
9761 if (elements_size > 0) { 9773 if (elements_size > 0) {
9762 HValue* object_elements_size = Add<HConstant>(elements_size); 9774 HValue* object_elements_size = Add<HConstant>(elements_size);
9763 if (boilerplate_object->HasFastDoubleElements()) { 9775 if (boilerplate_object->HasFastDoubleElements()) {
9764 // Allocation folding will not be able to fold |object| and 9776 // Allocation folding will not be able to fold |object| and
9765 // |object_elements| together if they are pre-tenured. 9777 // |object_elements| together if they are pre-tenured.
9766 if (pretenure_flag == TENURED) { 9778 if (pretenure_flag == TENURED) {
9767 HConstant* empty_fixed_array = Add<HConstant>( 9779 HConstant* empty_fixed_array = Add<HConstant>(
9768 isolate()->factory()->empty_fixed_array()); 9780 isolate()->factory()->empty_fixed_array());
9769 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), 9781 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
11285 if (ShouldProduceTraceOutput()) { 11297 if (ShouldProduceTraceOutput()) {
11286 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11298 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11287 } 11299 }
11288 11300
11289 #ifdef DEBUG 11301 #ifdef DEBUG
11290 graph_->Verify(false); // No full verify. 11302 graph_->Verify(false); // No full verify.
11291 #endif 11303 #endif
11292 } 11304 }
11293 11305
11294 } } // namespace v8::internal 11306 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698