OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 // Returns the current number of weak handles to global objects. | 140 // Returns the current number of weak handles to global objects. |
141 // These handles are also included in NumberOfWeakHandles(). | 141 // These handles are also included in NumberOfWeakHandles(). |
142 int NumberOfGlobalObjectWeakHandles() { | 142 int NumberOfGlobalObjectWeakHandles() { |
143 return number_of_global_object_weak_handles_; | 143 return number_of_global_object_weak_handles_; |
144 } | 144 } |
145 | 145 |
146 // Clear the weakness of a global handle. | 146 // Clear the weakness of a global handle. |
147 void ClearWeakness(Object** location); | 147 void ClearWeakness(Object** location); |
148 | 148 |
| 149 // Clear the weakness of a global handle. |
| 150 void MarkIndependent(Object** location); |
| 151 |
149 // Tells whether global handle is near death. | 152 // Tells whether global handle is near death. |
150 static bool IsNearDeath(Object** location); | 153 static bool IsNearDeath(Object** location); |
151 | 154 |
152 // Tells whether global handle is weak. | 155 // Tells whether global handle is weak. |
153 static bool IsWeak(Object** location); | 156 static bool IsWeak(Object** location); |
154 | 157 |
155 // Process pending weak handles. | 158 // Process pending weak handles. |
156 // Returns true if next major GC is likely to collect more garbage. | 159 // Returns true if next major GC is likely to collect more garbage. |
157 bool PostGarbageCollectionProcessing(); | 160 bool PostGarbageCollectionProcessing(); |
158 | 161 |
159 // Iterates over all strong handles. | 162 // Iterates over all strong handles. |
160 void IterateStrongRoots(ObjectVisitor* v); | 163 void IterateStrongRoots(ObjectVisitor* v); |
161 | 164 |
| 165 // Iterates over all strong and dependent handles. |
| 166 void IterateStrongAndDependentRoots(ObjectVisitor* v); |
| 167 |
162 // Iterates over all handles. | 168 // Iterates over all handles. |
163 void IterateAllRoots(ObjectVisitor* v); | 169 void IterateAllRoots(ObjectVisitor* v); |
164 | 170 |
165 // Iterates over all handles that have embedder-assigned class ID. | 171 // Iterates over all handles that have embedder-assigned class ID. |
166 void IterateAllRootsWithClassIds(ObjectVisitor* v); | 172 void IterateAllRootsWithClassIds(ObjectVisitor* v); |
167 | 173 |
168 // Iterates over all weak roots in heap. | 174 // Iterates over all weak roots in heap. |
169 void IterateWeakRoots(ObjectVisitor* v); | 175 void IterateWeakRoots(ObjectVisitor* v); |
170 | 176 |
| 177 // Iterates over all weak independent roots in heap. |
| 178 void IterateWeakIndependentRoots(ObjectVisitor* v); |
| 179 |
171 // Iterates over weak roots that are bound to a given callback. | 180 // Iterates over weak roots that are bound to a given callback. |
172 void IterateWeakRoots(WeakReferenceGuest f, | 181 void IterateWeakRoots(WeakReferenceGuest f, |
173 WeakReferenceCallback callback); | 182 WeakReferenceCallback callback); |
174 | 183 |
175 // Find all weak handles satisfying the callback predicate, mark | 184 // Find all weak handles satisfying the callback predicate, mark |
176 // them as pending. | 185 // them as pending. |
177 void IdentifyWeakHandles(WeakSlotCallback f); | 186 void IdentifyWeakHandles(WeakSlotCallback f); |
178 | 187 |
| 188 // Find all weak independent handles satisfying the callback predicate, mark |
| 189 // them as pending. |
| 190 void IdentifyWeakIndependentHandles(WeakSlotCallbackWithHeap f); |
| 191 |
179 // Add an object group. | 192 // Add an object group. |
180 // Should be only used in GC callback function before a collection. | 193 // Should be only used in GC callback function before a collection. |
181 // All groups are destroyed after a mark-compact collection. | 194 // All groups are destroyed after a mark-compact collection. |
182 void AddObjectGroup(Object*** handles, | 195 void AddObjectGroup(Object*** handles, |
183 size_t length, | 196 size_t length, |
184 v8::RetainedObjectInfo* info); | 197 v8::RetainedObjectInfo* info); |
185 | 198 |
186 // Add an implicit references' group. | 199 // Add an implicit references' group. |
187 // Should be only used in GC callback function before a collection. | 200 // Should be only used in GC callback function before a collection. |
188 // All groups are destroyed after a mark-compact collection. | 201 // All groups are destroyed after a mark-compact collection. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 275 |
263 friend class Isolate; | 276 friend class Isolate; |
264 | 277 |
265 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); | 278 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); |
266 }; | 279 }; |
267 | 280 |
268 | 281 |
269 } } // namespace v8::internal | 282 } } // namespace v8::internal |
270 | 283 |
271 #endif // V8_GLOBAL_HANDLES_H_ | 284 #endif // V8_GLOBAL_HANDLES_H_ |
OLD | NEW |