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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // Performs garbage collection operation. | 769 // Performs garbage collection operation. |
770 // Returns whether there is a chance that another major GC could | 770 // Returns whether there is a chance that another major GC could |
771 // collect more garbage. | 771 // collect more garbage. |
772 inline bool CollectGarbage( | 772 inline bool CollectGarbage( |
773 AllocationSpace space, const char* gc_reason = NULL, | 773 AllocationSpace space, const char* gc_reason = NULL, |
774 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 774 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
775 | 775 |
776 static const int kNoGCFlags = 0; | 776 static const int kNoGCFlags = 0; |
777 static const int kReduceMemoryFootprintMask = 1; | 777 static const int kReduceMemoryFootprintMask = 1; |
778 static const int kAbortIncrementalMarkingMask = 2; | 778 static const int kAbortIncrementalMarkingMask = 2; |
| 779 static const int kFinalizeIncrementalMarkingMask = 4; |
779 | 780 |
780 // Making the heap iterable requires us to abort incremental marking. | 781 // Making the heap iterable requires us to abort incremental marking. |
781 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask; | 782 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask; |
782 | 783 |
783 // Invoked when GC was requested via the stack guard. | 784 // Invoked when GC was requested via the stack guard. |
784 void HandleGCRequest(); | 785 void HandleGCRequest(); |
785 | 786 |
786 // Attempt to over-approximate the weak closure by marking object groups and | 787 // Attempt to over-approximate the weak closure by marking object groups and |
787 // implicit references from global handles, but don't atomically complete | 788 // implicit references from global handles, but don't atomically complete |
788 // marking. If we continue to mark incrementally, we might have marked | 789 // marking. If we continue to mark incrementally, we might have marked |
789 // objects that die later. | 790 // objects that die later. |
790 void OverApproximateWeakClosure(const char* gc_reason); | 791 void OverApproximateWeakClosure(const char* gc_reason); |
791 | 792 |
792 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is | 793 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is |
793 // non-zero, then the slower precise sweeper is used, which leaves the heap | 794 // non-zero, then the slower precise sweeper is used, which leaves the heap |
794 // in a state where we can iterate over the heap visiting all objects. | 795 // in a state where we can iterate over the heap visiting all objects. |
795 void CollectAllGarbage( | 796 void CollectAllGarbage( |
796 int flags, const char* gc_reason = NULL, | 797 int flags = kFinalizeIncrementalMarkingMask, const char* gc_reason = NULL, |
797 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 798 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
798 | 799 |
799 // Last hope GC, should try to squeeze as much as possible. | 800 // Last hope GC, should try to squeeze as much as possible. |
800 void CollectAllAvailableGarbage(const char* gc_reason = NULL); | 801 void CollectAllAvailableGarbage(const char* gc_reason = NULL); |
801 | 802 |
802 // Check whether the heap is currently iterable. | 803 // Check whether the heap is currently iterable. |
803 bool IsHeapIterable(); | 804 bool IsHeapIterable(); |
804 | 805 |
805 // Notify the heap that a context has been disposed. | 806 // Notify the heap that a context has been disposed. |
806 int NotifyContextDisposed(bool dependant_context); | 807 int NotifyContextDisposed(bool dependant_context); |
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2636 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2637 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2637 | 2638 |
2638 private: | 2639 private: |
2639 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2640 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2640 }; | 2641 }; |
2641 #endif // DEBUG | 2642 #endif // DEBUG |
2642 } | 2643 } |
2643 } // namespace v8::internal | 2644 } // namespace v8::internal |
2644 | 2645 |
2645 #endif // V8_HEAP_HEAP_H_ | 2646 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |