| 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 5329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5340 | 5340 |
| 5341 HeapObject* object; | 5341 HeapObject* object; |
| 5342 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_POINTER_SPACE); | 5342 { MaybeObject* maybe_object = AllocateRaw(size, space, OLD_POINTER_SPACE); |
| 5343 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; | 5343 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; |
| 5344 } | 5344 } |
| 5345 object = EnsureDoubleAligned(this, object, size); | 5345 object = EnsureDoubleAligned(this, object, size); |
| 5346 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map()); | 5346 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map()); |
| 5347 | 5347 |
| 5348 ConstantPoolArray* constant_pool = | 5348 ConstantPoolArray* constant_pool = |
| 5349 reinterpret_cast<ConstantPoolArray*>(object); | 5349 reinterpret_cast<ConstantPoolArray*>(object); |
| 5350 constant_pool->SetEntryCounts(number_of_int64_entries, | 5350 constant_pool->Init(number_of_int64_entries, |
| 5351 number_of_code_ptr_entries, | 5351 number_of_code_ptr_entries, |
| 5352 number_of_heap_ptr_entries, | 5352 number_of_heap_ptr_entries, |
| 5353 number_of_int32_entries); | 5353 number_of_int32_entries); |
| 5354 if (number_of_code_ptr_entries > 0) { | 5354 if (number_of_code_ptr_entries > 0) { |
| 5355 int offset = | 5355 int offset = |
| 5356 constant_pool->OffsetOfElementAt(constant_pool->first_code_ptr_index()); | 5356 constant_pool->OffsetOfElementAt(constant_pool->first_code_ptr_index()); |
| 5357 MemsetPointer( | 5357 MemsetPointer( |
| 5358 reinterpret_cast<Address*>(HeapObject::RawField(constant_pool, offset)), | 5358 reinterpret_cast<Address*>(HeapObject::RawField(constant_pool, offset)), |
| 5359 isolate()->builtins()->builtin(Builtins::kIllegal)->entry(), | 5359 isolate()->builtins()->builtin(Builtins::kIllegal)->entry(), |
| 5360 number_of_code_ptr_entries); | 5360 number_of_code_ptr_entries); |
| 5361 } | 5361 } |
| 5362 if (number_of_heap_ptr_entries > 0) { | 5362 if (number_of_heap_ptr_entries > 0) { |
| 5363 int offset = | 5363 int offset = |
| 5364 constant_pool->OffsetOfElementAt(constant_pool->first_heap_ptr_index()); | 5364 constant_pool->OffsetOfElementAt(constant_pool->first_heap_ptr_index()); |
| 5365 MemsetPointer( | 5365 MemsetPointer( |
| 5366 HeapObject::RawField(constant_pool, offset), | 5366 HeapObject::RawField(constant_pool, offset), |
| 5367 undefined_value(), | 5367 undefined_value(), |
| 5368 number_of_heap_ptr_entries); | 5368 number_of_heap_ptr_entries); |
| 5369 } | 5369 } |
| 5370 return constant_pool; | 5370 return constant_pool; |
| 5371 } | 5371 } |
| 5372 | 5372 |
| 5373 | 5373 |
| 5374 MaybeObject* Heap::AllocateEmptyConstantPoolArray() { | 5374 MaybeObject* Heap::AllocateEmptyConstantPoolArray() { |
| 5375 int size = ConstantPoolArray::SizeFor(0, 0, 0, 0); | 5375 int size = ConstantPoolArray::SizeFor(0, 0, 0, 0); |
| 5376 Object* result; | 5376 Object* result; |
| 5377 { MaybeObject* maybe_result = | 5377 { MaybeObject* maybe_result = |
| 5378 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); | 5378 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); |
| 5379 if (!maybe_result->ToObject(&result)) return maybe_result; | 5379 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 5380 } | 5380 } |
| 5381 HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map()); | 5381 HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map()); |
| 5382 ConstantPoolArray::cast(result)->SetEntryCounts(0, 0, 0, 0); | 5382 ConstantPoolArray::cast(result)->Init(0, 0, 0, 0); |
| 5383 return result; | 5383 return result; |
| 5384 } | 5384 } |
| 5385 | 5385 |
| 5386 | 5386 |
| 5387 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { | 5387 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { |
| 5388 Object* result; | 5388 Object* result; |
| 5389 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); | 5389 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); |
| 5390 if (!maybe_result->ToObject(&result)) return maybe_result; | 5390 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 5391 } | 5391 } |
| 5392 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( | 5392 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( |
| (...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7802 static_cast<int>(object_sizes_last_time_[index])); | 7802 static_cast<int>(object_sizes_last_time_[index])); |
| 7803 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7803 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7804 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7804 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7805 | 7805 |
| 7806 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7806 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7807 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7807 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7808 ClearObjectStats(); | 7808 ClearObjectStats(); |
| 7809 } | 7809 } |
| 7810 | 7810 |
| 7811 } } // namespace v8::internal | 7811 } } // namespace v8::internal |
| OLD | NEW |