Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 5020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5031 reinterpret_cast<FixedArray*>(result)->set_length(0); | 5031 reinterpret_cast<FixedArray*>(result)->set_length(0); |
| 5032 return result; | 5032 return result; |
| 5033 } | 5033 } |
| 5034 | 5034 |
| 5035 | 5035 |
| 5036 MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) { | 5036 MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) { |
| 5037 return AllocateExternalArray(0, array_type, NULL, TENURED); | 5037 return AllocateExternalArray(0, array_type, NULL, TENURED); |
| 5038 } | 5038 } |
| 5039 | 5039 |
| 5040 | 5040 |
| 5041 MaybeObject* Heap::CopyAndTenureFixedCOWArray(FixedArray* src) { | |
| 5042 ASSERT(InNewSpace(src)); | |
|
Hannes Payer (out of office)
2014/03/17 09:37:18
This ASSERT may be wrong here, but it should hold
mvstanton
2014/03/17 12:25:28
Great idea, thx, done.
| |
| 5043 int len = src->length(); | |
| 5044 Object* obj; | |
| 5045 { MaybeObject* maybe_obj = AllocateRawFixedArray(len, TENURED); | |
| 5046 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | |
| 5047 } | |
| 5048 HeapObject::cast(obj)->set_map_no_write_barrier(fixed_array_map()); | |
|
Hannes Payer (out of office)
2014/03/17 09:37:18
Can you set fixed_cow_array_map() here?
mvstanton
2014/03/17 12:25:28
No because of protections in FixedArray::set() aga
| |
| 5049 FixedArray* result = FixedArray::cast(obj); | |
| 5050 result->set_length(len); | |
| 5051 | |
| 5052 // Copy the content | |
| 5053 DisallowHeapAllocation no_gc; | |
| 5054 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); | |
| 5055 for (int i = 0; i < len; i++) result->set(i, src->get(i), mode); | |
| 5056 | |
| 5057 HeapObject::cast(obj)->set_map_no_write_barrier(fixed_cow_array_map()); | |
| 5058 return result; | |
| 5059 } | |
| 5060 | |
| 5061 | |
| 5041 MaybeObject* Heap::CopyFixedArrayWithMap(FixedArray* src, Map* map) { | 5062 MaybeObject* Heap::CopyFixedArrayWithMap(FixedArray* src, Map* map) { |
| 5042 int len = src->length(); | 5063 int len = src->length(); |
| 5043 Object* obj; | 5064 Object* obj; |
| 5044 { MaybeObject* maybe_obj = AllocateRawFixedArray(len, NOT_TENURED); | 5065 { MaybeObject* maybe_obj = AllocateRawFixedArray(len, NOT_TENURED); |
| 5045 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 5066 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 5046 } | 5067 } |
| 5047 if (InNewSpace(obj)) { | 5068 if (InNewSpace(obj)) { |
| 5048 HeapObject* dst = HeapObject::cast(obj); | 5069 HeapObject* dst = HeapObject::cast(obj); |
| 5049 dst->set_map_no_write_barrier(map); | 5070 dst->set_map_no_write_barrier(map); |
| 5050 CopyBlock(dst->address() + kPointerSize, | 5071 CopyBlock(dst->address() + kPointerSize, |
| (...skipping 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7698 static_cast<int>(object_sizes_last_time_[index])); | 7719 static_cast<int>(object_sizes_last_time_[index])); |
| 7699 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7720 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7700 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7721 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7701 | 7722 |
| 7702 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7723 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7703 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7724 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7704 ClearObjectStats(); | 7725 ClearObjectStats(); |
| 7705 } | 7726 } |
| 7706 | 7727 |
| 7707 } } // namespace v8::internal | 7728 } } // namespace v8::internal |
| OLD | NEW |