| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
| 6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 DISALLOW_COPY_AND_ASSIGN(PromotionQueue); | 397 DISALLOW_COPY_AND_ASSIGN(PromotionQueue); |
| 398 }; | 398 }; |
| 399 | 399 |
| 400 | 400 |
| 401 enum ArrayStorageAllocationMode { | 401 enum ArrayStorageAllocationMode { |
| 402 DONT_INITIALIZE_ARRAY_ELEMENTS, | 402 DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 403 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE | 403 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 enum class ClearRecordedSlots { kYes, kNo }; |
| 406 | 407 |
| 407 class Heap { | 408 class Heap { |
| 408 public: | 409 public: |
| 409 // Declare all the root indices. This defines the root list order. | 410 // Declare all the root indices. This defines the root list order. |
| 410 enum RootListIndex { | 411 enum RootListIndex { |
| 411 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 412 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 412 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) | 413 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 413 #undef ROOT_INDEX_DECLARATION | 414 #undef ROOT_INDEX_DECLARATION |
| 414 | 415 |
| 415 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, | 416 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 inline void ClearInstanceofCache(); | 626 inline void ClearInstanceofCache(); |
| 626 | 627 |
| 627 // FreeSpace objects have a null map after deserialization. Update the map. | 628 // FreeSpace objects have a null map after deserialization. Update the map. |
| 628 void RepairFreeListsAfterDeserialization(); | 629 void RepairFreeListsAfterDeserialization(); |
| 629 | 630 |
| 630 // Move len elements within a given array from src_index index to dst_index | 631 // Move len elements within a given array from src_index index to dst_index |
| 631 // index. | 632 // index. |
| 632 void MoveElements(FixedArray* array, int dst_index, int src_index, int len); | 633 void MoveElements(FixedArray* array, int dst_index, int src_index, int len); |
| 633 | 634 |
| 634 // Initialize a filler object to keep the ability to iterate over the heap | 635 // Initialize a filler object to keep the ability to iterate over the heap |
| 635 // when introducing gaps within pages. | 636 // when introducing gaps within pages. If slots could have been recorded in |
| 636 void CreateFillerObjectAt(Address addr, int size); | 637 // the freed area, then pass ClearRecordedSlots::kYes as the mode. Otherwise, |
| 638 // pass ClearRecordedSlots::kNo. |
| 639 void CreateFillerObjectAt(Address addr, int size, ClearRecordedSlots mode); |
| 637 | 640 |
| 638 bool CanMoveObjectStart(HeapObject* object); | 641 bool CanMoveObjectStart(HeapObject* object); |
| 639 | 642 |
| 640 // Maintain consistency of live bytes during incremental marking. | 643 // Maintain consistency of live bytes during incremental marking. |
| 641 void AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode); | 644 void AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode); |
| 642 | 645 |
| 643 // Trim the given array from the left. Note that this relocates the object | 646 // Trim the given array from the left. Note that this relocates the object |
| 644 // start and hence is only valid if there is only a single reference to it. | 647 // start and hence is only valid if there is only a single reference to it. |
| 645 FixedArrayBase* LeftTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); | 648 FixedArrayBase* LeftTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); |
| 646 | 649 |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 // =========================================================================== | 1056 // =========================================================================== |
| 1054 | 1057 |
| 1055 // Write barrier support for object[offset] = o; | 1058 // Write barrier support for object[offset] = o; |
| 1056 inline void RecordWrite(Object* object, int offset, Object* o); | 1059 inline void RecordWrite(Object* object, int offset, Object* o); |
| 1057 | 1060 |
| 1058 Address* store_buffer_top_address() { | 1061 Address* store_buffer_top_address() { |
| 1059 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); | 1062 return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]); |
| 1060 } | 1063 } |
| 1061 | 1064 |
| 1062 void ClearRecordedSlot(HeapObject* object, Object** slot); | 1065 void ClearRecordedSlot(HeapObject* object, Object** slot); |
| 1063 void ClearRecordedSlotRange(HeapObject* object, Object** start, Object** end); | 1066 void ClearRecordedSlotRange(Address start, Address end); |
| 1064 | 1067 |
| 1065 // =========================================================================== | 1068 // =========================================================================== |
| 1066 // Incremental marking API. ================================================== | 1069 // Incremental marking API. ================================================== |
| 1067 // =========================================================================== | 1070 // =========================================================================== |
| 1068 | 1071 |
| 1069 // Start incremental marking and ensure that idle time handler can perform | 1072 // Start incremental marking and ensure that idle time handler can perform |
| 1070 // incremental steps. | 1073 // incremental steps. |
| 1071 void StartIdleIncrementalMarking(); | 1074 void StartIdleIncrementalMarking(); |
| 1072 | 1075 |
| 1073 // Starts incremental marking assuming incremental marking is currently | 1076 // Starts incremental marking assuming incremental marking is currently |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 friend class LargeObjectSpace; | 2624 friend class LargeObjectSpace; |
| 2622 friend class NewSpace; | 2625 friend class NewSpace; |
| 2623 friend class PagedSpace; | 2626 friend class PagedSpace; |
| 2624 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2627 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2625 }; | 2628 }; |
| 2626 | 2629 |
| 2627 } // namespace internal | 2630 } // namespace internal |
| 2628 } // namespace v8 | 2631 } // namespace v8 |
| 2629 | 2632 |
| 2630 #endif // V8_HEAP_HEAP_H_ | 2633 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |