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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 // Trim the given array from the left. Note that this relocates the object | 759 // Trim the given array from the left. Note that this relocates the object |
760 // start and hence is only valid if there is only a single reference to it. | 760 // start and hence is only valid if there is only a single reference to it. |
761 FixedArrayBase* LeftTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); | 761 FixedArrayBase* LeftTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); |
762 | 762 |
763 // Trim the given array from the right. | 763 // Trim the given array from the right. |
764 void RightTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); | 764 void RightTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); |
765 | 765 |
766 // Converts the given boolean condition to JavaScript boolean value. | 766 // Converts the given boolean condition to JavaScript boolean value. |
767 inline Oddball* ToBoolean(bool condition); | 767 inline Oddball* ToBoolean(bool condition); |
768 | 768 |
769 // Check whether the heap is currently iterable. | |
770 bool IsHeapIterable(); | |
771 | |
772 // Notify the heap that a context has been disposed. | 769 // Notify the heap that a context has been disposed. |
773 int NotifyContextDisposed(bool dependant_context); | 770 int NotifyContextDisposed(bool dependant_context); |
774 | 771 |
775 void set_native_contexts_list(Object* object) { | 772 void set_native_contexts_list(Object* object) { |
776 native_contexts_list_ = object; | 773 native_contexts_list_ = object; |
777 } | 774 } |
778 Object* native_contexts_list() const { return native_contexts_list_; } | 775 Object* native_contexts_list() const { return native_contexts_list_; } |
779 | 776 |
780 void set_allocation_sites_list(Object* object) { | 777 void set_allocation_sites_list(Object* object) { |
781 allocation_sites_list_ = object; | 778 allocation_sites_list_ = object; |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2541 public: | 2538 public: |
2542 enum HeapObjectsFiltering { kNoFiltering, kFilterUnreachable }; | 2539 enum HeapObjectsFiltering { kNoFiltering, kFilterUnreachable }; |
2543 | 2540 |
2544 explicit HeapIterator(Heap* heap, | 2541 explicit HeapIterator(Heap* heap, |
2545 HeapObjectsFiltering filtering = kNoFiltering); | 2542 HeapObjectsFiltering filtering = kNoFiltering); |
2546 ~HeapIterator(); | 2543 ~HeapIterator(); |
2547 | 2544 |
2548 HeapObject* next(); | 2545 HeapObject* next(); |
2549 | 2546 |
2550 private: | 2547 private: |
2551 struct MakeHeapIterableHelper { | |
2552 explicit MakeHeapIterableHelper(Heap* heap) { heap->MakeHeapIterable(); } | |
2553 }; | |
2554 | |
2555 HeapObject* NextObject(); | 2548 HeapObject* NextObject(); |
2556 | 2549 |
2557 // The following two fields need to be declared in this order. Initialization | |
2558 // order guarantees that we first make the heap iterable (which may involve | |
2559 // allocations) and only then lock it down by not allowing further | |
2560 // allocations. | |
2561 MakeHeapIterableHelper make_heap_iterable_helper_; | |
2562 DisallowHeapAllocation no_heap_allocation_; | 2550 DisallowHeapAllocation no_heap_allocation_; |
2563 | 2551 |
2564 Heap* heap_; | 2552 Heap* heap_; |
2565 HeapObjectsFiltering filtering_; | 2553 HeapObjectsFiltering filtering_; |
2566 HeapObjectsFilter* filter_; | 2554 HeapObjectsFilter* filter_; |
2567 // Space iterator for iterating all the spaces. | 2555 // Space iterator for iterating all the spaces. |
2568 SpaceIterator* space_iterator_; | 2556 SpaceIterator* space_iterator_; |
2569 // Object iterator for the space currently being iterated. | 2557 // Object iterator for the space currently being iterated. |
2570 std::unique_ptr<ObjectIterator> object_iterator_; | 2558 std::unique_ptr<ObjectIterator> object_iterator_; |
2571 }; | 2559 }; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 friend class LargeObjectSpace; | 2679 friend class LargeObjectSpace; |
2692 friend class NewSpace; | 2680 friend class NewSpace; |
2693 friend class PagedSpace; | 2681 friend class PagedSpace; |
2694 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2682 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2695 }; | 2683 }; |
2696 | 2684 |
2697 } // namespace internal | 2685 } // namespace internal |
2698 } // namespace v8 | 2686 } // namespace v8 |
2699 | 2687 |
2700 #endif // V8_HEAP_HEAP_H_ | 2688 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |