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_H_ | 5 #ifndef V8_HEAP_H_ |
6 #define V8_HEAP_H_ | 6 #define V8_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 int flags, | 757 int flags, |
758 const char* gc_reason = NULL, | 758 const char* gc_reason = NULL, |
759 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 759 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
760 | 760 |
761 // Last hope GC, should try to squeeze as much as possible. | 761 // Last hope GC, should try to squeeze as much as possible. |
762 void CollectAllAvailableGarbage(const char* gc_reason = NULL); | 762 void CollectAllAvailableGarbage(const char* gc_reason = NULL); |
763 | 763 |
764 // Check whether the heap is currently iterable. | 764 // Check whether the heap is currently iterable. |
765 bool IsHeapIterable(); | 765 bool IsHeapIterable(); |
766 | 766 |
767 // Ensure that we have swept all spaces in such a way that we can iterate | |
768 // over all objects. May cause a GC. | |
769 void MakeHeapIterable(); | |
770 | |
771 // Notify the heap that a context has been disposed. | 767 // Notify the heap that a context has been disposed. |
772 int NotifyContextDisposed(); | 768 int NotifyContextDisposed(); |
773 | 769 |
774 inline void increment_scan_on_scavenge_pages() { | 770 inline void increment_scan_on_scavenge_pages() { |
775 scan_on_scavenge_pages_++; | 771 scan_on_scavenge_pages_++; |
776 if (FLAG_gc_verbose) { | 772 if (FLAG_gc_verbose) { |
777 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); | 773 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); |
778 } | 774 } |
779 } | 775 } |
780 | 776 |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 | 1705 |
1710 // Checks whether a global GC is necessary | 1706 // Checks whether a global GC is necessary |
1711 GarbageCollector SelectGarbageCollector(AllocationSpace space, | 1707 GarbageCollector SelectGarbageCollector(AllocationSpace space, |
1712 const char** reason); | 1708 const char** reason); |
1713 | 1709 |
1714 // Make sure there is a filler value behind the top of the new space | 1710 // Make sure there is a filler value behind the top of the new space |
1715 // so that the GC does not confuse some unintialized/stale memory | 1711 // so that the GC does not confuse some unintialized/stale memory |
1716 // with the allocation memento of the object at the top | 1712 // with the allocation memento of the object at the top |
1717 void EnsureFillerObjectAtTop(); | 1713 void EnsureFillerObjectAtTop(); |
1718 | 1714 |
| 1715 // Ensure that we have swept all spaces in such a way that we can iterate |
| 1716 // over all objects. May cause a GC. |
| 1717 void MakeHeapIterable(); |
| 1718 |
1719 // Performs garbage collection operation. | 1719 // Performs garbage collection operation. |
1720 // Returns whether there is a chance that another major GC could | 1720 // Returns whether there is a chance that another major GC could |
1721 // collect more garbage. | 1721 // collect more garbage. |
1722 bool CollectGarbage( | 1722 bool CollectGarbage( |
1723 GarbageCollector collector, | 1723 GarbageCollector collector, |
1724 const char* gc_reason, | 1724 const char* gc_reason, |
1725 const char* collector_reason, | 1725 const char* collector_reason, |
1726 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 1726 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
1727 | 1727 |
1728 // Performs garbage collection | 1728 // Performs garbage collection |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 ExternalStringTable external_string_table_; | 2173 ExternalStringTable external_string_table_; |
2174 | 2174 |
2175 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2175 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2176 | 2176 |
2177 MemoryChunk* chunks_queued_for_free_; | 2177 MemoryChunk* chunks_queued_for_free_; |
2178 | 2178 |
2179 Mutex relocation_mutex_; | 2179 Mutex relocation_mutex_; |
2180 | 2180 |
2181 int gc_callbacks_depth_; | 2181 int gc_callbacks_depth_; |
2182 | 2182 |
| 2183 friend class AlwaysAllocateScope; |
2183 friend class Factory; | 2184 friend class Factory; |
| 2185 friend class GCCallbacksScope; |
2184 friend class GCTracer; | 2186 friend class GCTracer; |
2185 friend class AlwaysAllocateScope; | 2187 friend class HeapIterator; |
2186 friend class Page; | |
2187 friend class Isolate; | 2188 friend class Isolate; |
2188 friend class MarkCompactCollector; | 2189 friend class MarkCompactCollector; |
2189 friend class MarkCompactMarkingVisitor; | 2190 friend class MarkCompactMarkingVisitor; |
2190 friend class MapCompact; | 2191 friend class MapCompact; |
2191 #ifdef VERIFY_HEAP | 2192 #ifdef VERIFY_HEAP |
2192 friend class NoWeakObjectVerificationScope; | 2193 friend class NoWeakObjectVerificationScope; |
2193 #endif | 2194 #endif |
2194 friend class GCCallbacksScope; | 2195 friend class Page; |
2195 | 2196 |
2196 DISALLOW_COPY_AND_ASSIGN(Heap); | 2197 DISALLOW_COPY_AND_ASSIGN(Heap); |
2197 }; | 2198 }; |
2198 | 2199 |
2199 | 2200 |
2200 class HeapStats { | 2201 class HeapStats { |
2201 public: | 2202 public: |
2202 static const int kStartMarker = 0xDECADE00; | 2203 static const int kStartMarker = 0xDECADE00; |
2203 static const int kEndMarker = 0xDECADE01; | 2204 static const int kEndMarker = 0xDECADE01; |
2204 | 2205 |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2788 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2789 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2789 | 2790 |
2790 private: | 2791 private: |
2791 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2792 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2792 }; | 2793 }; |
2793 #endif // DEBUG | 2794 #endif // DEBUG |
2794 | 2795 |
2795 } } // namespace v8::internal | 2796 } } // namespace v8::internal |
2796 | 2797 |
2797 #endif // V8_HEAP_H_ | 2798 #endif // V8_HEAP_H_ |
OLD | NEW |