| 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 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2572 // | 2572 // |
| 2573 // HeapIterator can skip free list nodes (that is, de-allocated heap | 2573 // HeapIterator can skip free list nodes (that is, de-allocated heap |
| 2574 // objects that still remain in the heap). As implementation of free | 2574 // objects that still remain in the heap). As implementation of free |
| 2575 // nodes filtering uses GC marks, it can't be used during MS/MC GC | 2575 // nodes filtering uses GC marks, it can't be used during MS/MC GC |
| 2576 // phases. Also, it is forbidden to interrupt iteration in this mode, | 2576 // phases. Also, it is forbidden to interrupt iteration in this mode, |
| 2577 // as this will leave heap objects marked (and thus, unusable). | 2577 // as this will leave heap objects marked (and thus, unusable). |
| 2578 class HeapIterator BASE_EMBEDDED { | 2578 class HeapIterator BASE_EMBEDDED { |
| 2579 public: | 2579 public: |
| 2580 enum HeapObjectsFiltering { kNoFiltering, kFilterUnreachable }; | 2580 enum HeapObjectsFiltering { kNoFiltering, kFilterUnreachable }; |
| 2581 | 2581 |
| 2582 explicit HeapIterator(Heap* heap); | 2582 explicit HeapIterator(Heap* heap, |
| 2583 HeapIterator(Heap* heap, HeapObjectsFiltering filtering); | 2583 HeapObjectsFiltering filtering = kNoFiltering); |
| 2584 ~HeapIterator(); | 2584 ~HeapIterator(); |
| 2585 | 2585 |
| 2586 HeapObject* next(); | 2586 HeapObject* next(); |
| 2587 void reset(); | |
| 2588 | 2587 |
| 2589 private: | 2588 private: |
| 2590 struct MakeHeapIterableHelper { | 2589 struct MakeHeapIterableHelper { |
| 2591 explicit MakeHeapIterableHelper(Heap* heap) { heap->MakeHeapIterable(); } | 2590 explicit MakeHeapIterableHelper(Heap* heap) { heap->MakeHeapIterable(); } |
| 2592 }; | 2591 }; |
| 2593 | 2592 |
| 2594 // Perform the initialization. | |
| 2595 void Init(); | |
| 2596 // Perform all necessary shutdown (destruction) work. | |
| 2597 void Shutdown(); | |
| 2598 HeapObject* NextObject(); | 2593 HeapObject* NextObject(); |
| 2599 | 2594 |
| 2595 // The following two fields need to be declared in this order. Initialization |
| 2596 // order guarantees that we first make the heap iterable (which may involve |
| 2597 // allocations) and only then lock it down by not allowing further |
| 2598 // allocations. |
| 2600 MakeHeapIterableHelper make_heap_iterable_helper_; | 2599 MakeHeapIterableHelper make_heap_iterable_helper_; |
| 2601 DisallowHeapAllocation no_heap_allocation_; | 2600 DisallowHeapAllocation no_heap_allocation_; |
| 2601 |
| 2602 Heap* heap_; | 2602 Heap* heap_; |
| 2603 HeapObjectsFiltering filtering_; | 2603 HeapObjectsFiltering filtering_; |
| 2604 HeapObjectsFilter* filter_; | 2604 HeapObjectsFilter* filter_; |
| 2605 // Space iterator for iterating all the spaces. | 2605 // Space iterator for iterating all the spaces. |
| 2606 SpaceIterator* space_iterator_; | 2606 SpaceIterator* space_iterator_; |
| 2607 // Object iterator for the space currently being iterated. | 2607 // Object iterator for the space currently being iterated. |
| 2608 ObjectIterator* object_iterator_; | 2608 ObjectIterator* object_iterator_; |
| 2609 }; | 2609 }; |
| 2610 | 2610 |
| 2611 | 2611 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2787 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2787 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2788 | 2788 |
| 2789 private: | 2789 private: |
| 2790 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2790 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2791 }; | 2791 }; |
| 2792 #endif // DEBUG | 2792 #endif // DEBUG |
| 2793 } | 2793 } |
| 2794 } // namespace v8::internal | 2794 } // namespace v8::internal |
| 2795 | 2795 |
| 2796 #endif // V8_HEAP_HEAP_H_ | 2796 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |