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 = 3; | |
ulan
2015/04/14 11:56:49
This should be 4, otherwise it is the same as (kRe
Hannes Payer (out of office)
2015/04/15 06:44:03
Uh, yes. Done.
| |
760 | 761 |
761 // Making the heap iterable requires us to abort incremental marking. | 762 // Making the heap iterable requires us to abort incremental marking. |
762 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask; | 763 static const int kMakeHeapIterableMask = kAbortIncrementalMarkingMask; |
763 | 764 |
764 // Invoked when GC was requested via the stack guard. | 765 // Invoked when GC was requested via the stack guard. |
765 void HandleGCRequest(); | 766 void HandleGCRequest(); |
766 | 767 |
767 // Attempt to over-approximate the weak closure by marking object groups and | 768 // Attempt to over-approximate the weak closure by marking object groups and |
768 // implicit references from global handles, but don't atomically complete | 769 // implicit references from global handles, but don't atomically complete |
769 // marking. If we continue to mark incrementally, we might have marked | 770 // marking. If we continue to mark incrementally, we might have marked |
770 // objects that die later. | 771 // objects that die later. |
771 void OverApproximateWeakClosure(const char* gc_reason); | 772 void OverApproximateWeakClosure(const char* gc_reason); |
772 | 773 |
773 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is | 774 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is |
774 // non-zero, then the slower precise sweeper is used, which leaves the heap | 775 // non-zero, then the slower precise sweeper is used, which leaves the heap |
775 // in a state where we can iterate over the heap visiting all objects. | 776 // in a state where we can iterate over the heap visiting all objects. |
776 void CollectAllGarbage( | 777 void CollectAllGarbage( |
777 int flags, const char* gc_reason = NULL, | 778 int flags = kFinalizeIncrementalMarkingMask, const char* gc_reason = NULL, |
778 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 779 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
779 | 780 |
780 // Last hope GC, should try to squeeze as much as possible. | 781 // Last hope GC, should try to squeeze as much as possible. |
781 void CollectAllAvailableGarbage(const char* gc_reason = NULL); | 782 void CollectAllAvailableGarbage(const char* gc_reason = NULL); |
782 | 783 |
783 // Check whether the heap is currently iterable. | 784 // Check whether the heap is currently iterable. |
784 bool IsHeapIterable(); | 785 bool IsHeapIterable(); |
785 | 786 |
786 // Notify the heap that a context has been disposed. | 787 // Notify the heap that a context has been disposed. |
787 int NotifyContextDisposed(bool dependant_context); | 788 int NotifyContextDisposed(bool dependant_context); |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2606 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2607 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2607 | 2608 |
2608 private: | 2609 private: |
2609 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2610 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2610 }; | 2611 }; |
2611 #endif // DEBUG | 2612 #endif // DEBUG |
2612 } | 2613 } |
2613 } // namespace v8::internal | 2614 } // namespace v8::internal |
2614 | 2615 |
2615 #endif // V8_HEAP_HEAP_H_ | 2616 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |