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 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 // Performs garbage collection operation. | 750 // Performs garbage collection operation. |
751 // Returns whether there is a chance that another major GC could | 751 // Returns whether there is a chance that another major GC could |
752 // collect more garbage. | 752 // collect more garbage. |
753 inline bool CollectGarbage( | 753 inline bool CollectGarbage( |
754 AllocationSpace space, const char* gc_reason = NULL, | 754 AllocationSpace space, const char* gc_reason = NULL, |
755 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 755 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
756 | 756 |
757 static const int kNoGCFlags = 0; | 757 static const int kNoGCFlags = 0; |
758 static const int kReduceMemoryFootprintMask = 1; | 758 static const int kReduceMemoryFootprintMask = 1; |
759 static const int kAbortIncrementalMarkingMask = 2; | 759 static const int kAbortIncrementalMarkingMask = 2; |
760 static const int kFinalizeIncrementalMarkingMask = 4; | |
761 | 760 |
762 // Making the heap iterable requires us to abort incremental marking. | 761 // Making the heap iterable requires us to abort incremental marking. |
763 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask; | 762 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask; |
764 | 763 |
765 // Invoked when GC was requested via the stack guard. | 764 // Invoked when GC was requested via the stack guard. |
766 void HandleGCRequest(); | 765 void HandleGCRequest(); |
767 | 766 |
768 // Attempt to over-approximate the weak closure by marking object groups and | 767 // Attempt to over-approximate the weak closure by marking object groups and |
769 // implicit references from global handles, but don't atomically complete | 768 // implicit references from global handles, but don't atomically complete |
770 // marking. If we continue to mark incrementally, we might have marked | 769 // marking. If we continue to mark incrementally, we might have marked |
771 // objects that die later. | 770 // objects that die later. |
772 void OverApproximateWeakClosure(const char* gc_reason); | 771 void OverApproximateWeakClosure(const char* gc_reason); |
773 | 772 |
774 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is | 773 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is |
775 // non-zero, then the slower precise sweeper is used, which leaves the heap | 774 // non-zero, then the slower precise sweeper is used, which leaves the heap |
776 // in a state where we can iterate over the heap visiting all objects. | 775 // in a state where we can iterate over the heap visiting all objects. |
777 void CollectAllGarbage( | 776 void CollectAllGarbage( |
778 int flags = kFinalizeIncrementalMarkingMask, const char* gc_reason = NULL, | 777 int flags, const char* gc_reason = NULL, |
779 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 778 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
780 | 779 |
781 // Last hope GC, should try to squeeze as much as possible. | 780 // Last hope GC, should try to squeeze as much as possible. |
782 void CollectAllAvailableGarbage(const char* gc_reason = NULL); | 781 void CollectAllAvailableGarbage(const char* gc_reason = NULL); |
783 | 782 |
784 // Check whether the heap is currently iterable. | 783 // Check whether the heap is currently iterable. |
785 bool IsHeapIterable(); | 784 bool IsHeapIterable(); |
786 | 785 |
787 // Notify the heap that a context has been disposed. | 786 // Notify the heap that a context has been disposed. |
788 int NotifyContextDisposed(bool dependant_context); | 787 int NotifyContextDisposed(bool dependant_context); |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2607 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2606 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2608 | 2607 |
2609 private: | 2608 private: |
2610 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2609 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2611 }; | 2610 }; |
2612 #endif // DEBUG | 2611 #endif // DEBUG |
2613 } | 2612 } |
2614 } // namespace v8::internal | 2613 } // namespace v8::internal |
2615 | 2614 |
2616 #endif // V8_HEAP_HEAP_H_ | 2615 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |