OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_GLOBAL_HANDLES_H_ | 5 #ifndef V8_GLOBAL_HANDLES_H_ |
6 #define V8_GLOBAL_HANDLES_H_ | 6 #define V8_GLOBAL_HANDLES_H_ |
7 | 7 |
8 #include <type_traits> | 8 #include <type_traits> |
9 | 9 |
10 #include "include/v8.h" | 10 #include "include/v8.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 int PostGarbageCollectionProcessing( | 124 int PostGarbageCollectionProcessing( |
125 GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags); | 125 GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags); |
126 | 126 |
127 // Iterates over all strong handles. | 127 // Iterates over all strong handles. |
128 void IterateStrongRoots(ObjectVisitor* v); | 128 void IterateStrongRoots(ObjectVisitor* v); |
129 | 129 |
130 // Iterates over all handles. | 130 // Iterates over all handles. |
131 void IterateAllRoots(ObjectVisitor* v); | 131 void IterateAllRoots(ObjectVisitor* v); |
132 | 132 |
133 // Iterates over all handles that have embedder-assigned class ID. | 133 // Iterates over all handles that have embedder-assigned class ID. |
134 void IterateAllRootsWithClassIds(ObjectVisitor* v); | 134 void IterateAllRootsWithClassIds(v8::PersistentHandleVisitor* v); |
135 | 135 |
136 // Iterates over all handles in the new space that have embedder-assigned | 136 // Iterates over all handles in the new space that have embedder-assigned |
137 // class ID. | 137 // class ID. |
138 void IterateAllRootsInNewSpaceWithClassIds(ObjectVisitor* v); | 138 void IterateAllRootsInNewSpaceWithClassIds(v8::PersistentHandleVisitor* v); |
139 | 139 |
140 // Iterate over all handles in the new space that are weak, unmodified | 140 // Iterate over all handles in the new space that are weak, unmodified |
141 // and have class IDs | 141 // and have class IDs |
142 void IterateWeakRootsInNewSpaceWithClassIds(ObjectVisitor* v); | 142 void IterateWeakRootsInNewSpaceWithClassIds(v8::PersistentHandleVisitor* v); |
143 | 143 |
144 // Iterates over all weak roots in heap. | 144 // Iterates over all weak roots in heap. |
145 void IterateWeakRoots(ObjectVisitor* v); | 145 void IterateWeakRoots(ObjectVisitor* v); |
146 | 146 |
147 // Find all weak handles satisfying the callback predicate, mark | 147 // Find all weak handles satisfying the callback predicate, mark |
148 // them as pending. | 148 // them as pending. |
149 void IdentifyWeakHandles(WeakSlotCallback f); | 149 void IdentifyWeakHandles(WeakSlotCallback f); |
150 | 150 |
151 // NOTE: Five ...NewSpace... functions below are used during | 151 // NOTE: Five ...NewSpace... functions below are used during |
152 // scavenge collections and iterate over sets of handles that are | 152 // scavenge collections and iterate over sets of handles that are |
(...skipping 29 matching lines...) Expand all Loading... |
182 void TearDown(); | 182 void TearDown(); |
183 | 183 |
184 Isolate* isolate() { return isolate_; } | 184 Isolate* isolate() { return isolate_; } |
185 | 185 |
186 #ifdef DEBUG | 186 #ifdef DEBUG |
187 void PrintStats(); | 187 void PrintStats(); |
188 void Print(); | 188 void Print(); |
189 #endif // DEBUG | 189 #endif // DEBUG |
190 | 190 |
191 private: | 191 private: |
| 192 // Internal node structures. |
| 193 class Node; |
| 194 class NodeBlock; |
| 195 class NodeIterator; |
| 196 class PendingPhantomCallback; |
| 197 class PendingPhantomCallbacksSecondPassTask; |
| 198 |
192 explicit GlobalHandles(Isolate* isolate); | 199 explicit GlobalHandles(Isolate* isolate); |
193 | 200 |
194 class PendingPhantomCallback; | |
195 | |
196 // Helpers for PostGarbageCollectionProcessing. | 201 // Helpers for PostGarbageCollectionProcessing. |
197 static void InvokeSecondPassPhantomCallbacks( | 202 static void InvokeSecondPassPhantomCallbacks( |
198 List<PendingPhantomCallback>* callbacks, Isolate* isolate); | 203 List<PendingPhantomCallback>* callbacks, Isolate* isolate); |
199 int PostScavengeProcessing(int initial_post_gc_processing_count); | 204 int PostScavengeProcessing(int initial_post_gc_processing_count); |
200 int PostMarkSweepProcessing(int initial_post_gc_processing_count); | 205 int PostMarkSweepProcessing(int initial_post_gc_processing_count); |
201 int DispatchPendingPhantomCallbacks(bool synchronous_second_pass); | 206 int DispatchPendingPhantomCallbacks(bool synchronous_second_pass); |
202 void UpdateListOfNewSpaceNodes(); | 207 void UpdateListOfNewSpaceNodes(); |
203 | 208 void ApplyPersistentHandleVisitor(v8::PersistentHandleVisitor* visitor, |
204 // Internal node structures. | 209 Node* node); |
205 class Node; | |
206 class NodeBlock; | |
207 class NodeIterator; | |
208 class PendingPhantomCallbacksSecondPassTask; | |
209 | 210 |
210 Isolate* isolate_; | 211 Isolate* isolate_; |
211 | 212 |
212 // Field always containing the number of handles to global objects. | 213 // Field always containing the number of handles to global objects. |
213 int number_of_global_handles_; | 214 int number_of_global_handles_; |
214 | 215 |
215 // List of all allocated node blocks. | 216 // List of all allocated node blocks. |
216 NodeBlock* first_block_; | 217 NodeBlock* first_block_; |
217 | 218 |
218 // List of node blocks with used nodes. | 219 // List of node blocks with used nodes. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; | 328 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; |
328 | 329 |
329 DISALLOW_COPY_AND_ASSIGN(EternalHandles); | 330 DISALLOW_COPY_AND_ASSIGN(EternalHandles); |
330 }; | 331 }; |
331 | 332 |
332 | 333 |
333 } // namespace internal | 334 } // namespace internal |
334 } // namespace v8 | 335 } // namespace v8 |
335 | 336 |
336 #endif // V8_GLOBAL_HANDLES_H_ | 337 #endif // V8_GLOBAL_HANDLES_H_ |
OLD | NEW |