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

Side by Side Diff: src/heap.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.h ('k') | src/hydrogen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5022 matching lines...) Expand 10 before | Expand all | Expand 10 after
5033 reinterpret_cast<FixedArray*>(result)->set_length(0); 5033 reinterpret_cast<FixedArray*>(result)->set_length(0);
5034 return result; 5034 return result;
5035 } 5035 }
5036 5036
5037 5037
5038 MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) { 5038 MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) {
5039 return AllocateExternalArray(0, array_type, NULL, TENURED); 5039 return AllocateExternalArray(0, array_type, NULL, TENURED);
5040 } 5040 }
5041 5041
5042 5042
5043 MaybeObject* Heap::CopyAndTenureFixedCOWArray(FixedArray* src) {
5044 if (!InNewSpace(src)) {
5045 return src;
5046 }
5047
5048 int len = src->length();
5049 Object* obj;
5050 { MaybeObject* maybe_obj = AllocateRawFixedArray(len, TENURED);
5051 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
5052 }
5053 HeapObject::cast(obj)->set_map_no_write_barrier(fixed_array_map());
5054 FixedArray* result = FixedArray::cast(obj);
5055 result->set_length(len);
5056
5057 // Copy the content
5058 DisallowHeapAllocation no_gc;
5059 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
5060 for (int i = 0; i < len; i++) result->set(i, src->get(i), mode);
5061
5062 // TODO(mvstanton): The map is set twice because of protection against calling
5063 // set() on a COW FixedArray. Issue v8:3221 created to track this, and
5064 // we might then be able to remove this whole method.
5065 HeapObject::cast(obj)->set_map_no_write_barrier(fixed_cow_array_map());
5066 return result;
5067 }
5068
5069
5043 MaybeObject* Heap::CopyFixedArrayWithMap(FixedArray* src, Map* map) { 5070 MaybeObject* Heap::CopyFixedArrayWithMap(FixedArray* src, Map* map) {
5044 int len = src->length(); 5071 int len = src->length();
5045 Object* obj; 5072 Object* obj;
5046 { MaybeObject* maybe_obj = AllocateRawFixedArray(len, NOT_TENURED); 5073 { MaybeObject* maybe_obj = AllocateRawFixedArray(len, NOT_TENURED);
5047 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 5074 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
5048 } 5075 }
5049 if (InNewSpace(obj)) { 5076 if (InNewSpace(obj)) {
5050 HeapObject* dst = HeapObject::cast(obj); 5077 HeapObject* dst = HeapObject::cast(obj);
5051 dst->set_map_no_write_barrier(map); 5078 dst->set_map_no_write_barrier(map);
5052 CopyBlock(dst->address() + kPointerSize, 5079 CopyBlock(dst->address() + kPointerSize,
(...skipping 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after
7714 static_cast<int>(object_sizes_last_time_[index])); 7741 static_cast<int>(object_sizes_last_time_[index]));
7715 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 7742 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
7716 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7743 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7717 7744
7718 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7745 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7719 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7746 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7720 ClearObjectStats(); 7747 ClearObjectStats();
7721 } 7748 }
7722 7749
7723 } } // namespace v8::internal 7750 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698