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 5111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5122 dst->address() + FixedDoubleArray::kLengthOffset, | 5122 dst->address() + FixedDoubleArray::kLengthOffset, |
| 5123 src->address() + FixedDoubleArray::kLengthOffset, | 5123 src->address() + FixedDoubleArray::kLengthOffset, |
| 5124 FixedDoubleArray::SizeFor(len) - FixedDoubleArray::kLengthOffset); | 5124 FixedDoubleArray::SizeFor(len) - FixedDoubleArray::kLengthOffset); |
| 5125 return obj; | 5125 return obj; |
| 5126 } | 5126 } |
| 5127 | 5127 |
| 5128 | 5128 |
| 5129 MaybeObject* Heap::CopyConstantPoolArrayWithMap(ConstantPoolArray* src, | 5129 MaybeObject* Heap::CopyConstantPoolArrayWithMap(ConstantPoolArray* src, |
| 5130 Map* map) { | 5130 Map* map) { |
| 5131 int int64_entries = src->count_of_int64_entries(); | 5131 int int64_entries = src->count_of_int64_entries(); |
| 5132 int ptr_entries = src->count_of_ptr_entries(); | 5132 int code_ptr_entries = src->count_of_code_ptr_entries(); |
| 5133 int heap_ptr_entries = src->count_of_heap_ptr_entries(); | |
| 5133 int int32_entries = src->count_of_int32_entries(); | 5134 int int32_entries = src->count_of_int32_entries(); |
| 5134 Object* obj; | 5135 Object* obj; |
| 5135 { MaybeObject* maybe_obj = | 5136 { MaybeObject* maybe_obj = |
| 5136 AllocateConstantPoolArray(int64_entries, ptr_entries, int32_entries); | 5137 AllocateConstantPoolArray(int64_entries, code_ptr_entries, |
| 5138 heap_ptr_entries, int32_entries); | |
| 5137 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 5139 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 5138 } | 5140 } |
| 5139 HeapObject* dst = HeapObject::cast(obj); | 5141 HeapObject* dst = HeapObject::cast(obj); |
| 5140 dst->set_map_no_write_barrier(map); | 5142 dst->set_map_no_write_barrier(map); |
| 5143 int size = ConstantPoolArray::SizeFor( | |
| 5144 int64_entries, code_ptr_entries, heap_ptr_entries, int32_entries); | |
| 5141 CopyBlock( | 5145 CopyBlock( |
| 5142 dst->address() + ConstantPoolArray::kLengthOffset, | 5146 dst->address() + ConstantPoolArray::kLengthOffset, |
| 5143 src->address() + ConstantPoolArray::kLengthOffset, | 5147 src->address() + ConstantPoolArray::kLengthOffset, |
| 5144 ConstantPoolArray::SizeFor(int64_entries, ptr_entries, int32_entries) | 5148 size - ConstantPoolArray::kLengthOffset); |
| 5145 - ConstantPoolArray::kLengthOffset); | |
| 5146 return obj; | 5149 return obj; |
| 5147 } | 5150 } |
| 5148 | 5151 |
| 5149 | 5152 |
| 5150 MaybeObject* Heap::AllocateRawFixedArray(int length, PretenureFlag pretenure) { | 5153 MaybeObject* Heap::AllocateRawFixedArray(int length, PretenureFlag pretenure) { |
| 5151 if (length < 0 || length > FixedArray::kMaxLength) { | 5154 if (length < 0 || length > FixedArray::kMaxLength) { |
| 5152 return Failure::OutOfMemoryException(0xe); | 5155 return Failure::OutOfMemoryException(0xe); |
| 5153 } | 5156 } |
| 5154 int size = FixedArray::SizeFor(length); | 5157 int size = FixedArray::SizeFor(length); |
| 5155 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, pretenure); | 5158 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, pretenure); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5272 HeapObject* object; | 5275 HeapObject* object; |
| 5273 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_DATA_SPACE); | 5276 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_DATA_SPACE); |
| 5274 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; | 5277 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; |
| 5275 } | 5278 } |
| 5276 | 5279 |
| 5277 return EnsureDoubleAligned(this, object, size); | 5280 return EnsureDoubleAligned(this, object, size); |
| 5278 } | 5281 } |
| 5279 | 5282 |
| 5280 | 5283 |
| 5281 MaybeObject* Heap::AllocateConstantPoolArray(int number_of_int64_entries, | 5284 MaybeObject* Heap::AllocateConstantPoolArray(int number_of_int64_entries, |
| 5282 int number_of_ptr_entries, | 5285 int number_of_code_ptr_entries, |
| 5286 int number_of_heap_ptr_entries, | |
| 5283 int number_of_int32_entries) { | 5287 int number_of_int32_entries) { |
| 5284 ASSERT(number_of_int64_entries > 0 || number_of_ptr_entries > 0 || | 5288 ASSERT(number_of_int64_entries > 0 || number_of_code_ptr_entries > 0 || |
| 5285 number_of_int32_entries > 0); | 5289 number_of_heap_ptr_entries > 0 || number_of_int32_entries > 0); |
| 5286 int size = ConstantPoolArray::SizeFor(number_of_int64_entries, | 5290 int size = ConstantPoolArray::SizeFor(number_of_int64_entries, |
| 5287 number_of_ptr_entries, | 5291 number_of_code_ptr_entries, |
| 5292 number_of_heap_ptr_entries, | |
| 5288 number_of_int32_entries); | 5293 number_of_int32_entries); |
| 5289 #ifndef V8_HOST_ARCH_64_BIT | 5294 #ifndef V8_HOST_ARCH_64_BIT |
| 5290 size += kPointerSize; | 5295 size += kPointerSize; |
| 5291 #endif | 5296 #endif |
| 5292 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED); | 5297 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED); |
| 5293 | 5298 |
| 5294 HeapObject* object; | 5299 HeapObject* object; |
| 5295 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_POINTER_SPACE); | 5300 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_POINTER_SPACE); |
| 5296 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; | 5301 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; |
| 5297 } | 5302 } |
| 5298 object = EnsureDoubleAligned(this, object, size); | 5303 object = EnsureDoubleAligned(this, object, size); |
| 5299 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map()); | 5304 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map()); |
| 5300 | 5305 |
| 5301 ConstantPoolArray* constant_pool = | 5306 ConstantPoolArray* constant_pool = |
| 5302 reinterpret_cast<ConstantPoolArray*>(object); | 5307 reinterpret_cast<ConstantPoolArray*>(object); |
| 5303 constant_pool->SetEntryCounts(number_of_int64_entries, | 5308 constant_pool->SetEntryCounts(number_of_int64_entries, |
| 5304 number_of_ptr_entries, | 5309 number_of_code_ptr_entries, |
| 5310 number_of_heap_ptr_entries, | |
| 5305 number_of_int32_entries); | 5311 number_of_int32_entries); |
| 5306 if (number_of_ptr_entries > 0) { | 5312 if (number_of_heap_ptr_entries > 0) { |
|
Michael Starzinger
2014/03/07 15:07:47
Can we really skip initializing the code_ptr_entri
rmcilroy
2014/03/10 14:03:05
Yes I think you are right. At the moment I don't
| |
| 5307 MemsetPointer( | 5313 MemsetPointer( |
| 5308 HeapObject::RawField( | 5314 HeapObject::RawField(constant_pool, |
| 5309 constant_pool, | 5315 constant_pool->OffsetOfElementAt( |
| 5310 constant_pool->OffsetOfElementAt(constant_pool->first_ptr_index())), | 5316 constant_pool->first_heap_ptr_index())), |
| 5311 undefined_value(), | 5317 undefined_value(), |
| 5312 number_of_ptr_entries); | 5318 number_of_heap_ptr_entries); |
| 5313 } | 5319 } |
| 5314 return constant_pool; | 5320 return constant_pool; |
| 5315 } | 5321 } |
| 5316 | 5322 |
| 5317 | 5323 |
| 5318 MaybeObject* Heap::AllocateEmptyConstantPoolArray() { | 5324 MaybeObject* Heap::AllocateEmptyConstantPoolArray() { |
| 5319 int size = ConstantPoolArray::SizeFor(0, 0, 0); | 5325 int size = ConstantPoolArray::SizeFor(0, 0, 0, 0); |
| 5320 Object* result; | 5326 Object* result; |
| 5321 { MaybeObject* maybe_result = | 5327 { MaybeObject* maybe_result = |
| 5322 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); | 5328 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); |
| 5323 if (!maybe_result->ToObject(&result)) return maybe_result; | 5329 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 5324 } | 5330 } |
| 5325 HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map()); | 5331 HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map()); |
| 5326 ConstantPoolArray::cast(result)->SetEntryCounts(0, 0, 0); | 5332 ConstantPoolArray::cast(result)->SetEntryCounts(0, 0, 0, 0); |
| 5327 return result; | 5333 return result; |
| 5328 } | 5334 } |
| 5329 | 5335 |
| 5330 | 5336 |
| 5331 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { | 5337 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { |
| 5332 Object* result; | 5338 Object* result; |
| 5333 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); | 5339 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); |
| 5334 if (!maybe_result->ToObject(&result)) return maybe_result; | 5340 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 5335 } | 5341 } |
| 5336 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( | 5342 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7743 static_cast<int>(object_sizes_last_time_[index])); | 7749 static_cast<int>(object_sizes_last_time_[index])); |
| 7744 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7750 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7745 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7751 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7746 | 7752 |
| 7747 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7753 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7748 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7754 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7749 ClearObjectStats(); | 7755 ClearObjectStats(); |
| 7750 } | 7756 } |
| 7751 | 7757 |
| 7752 } } // namespace v8::internal | 7758 } } // namespace v8::internal |
| OLD | NEW |