| 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 "include/v8.h" | 8 #include "include/v8.h" |
| 9 #include "include/v8-profiler.h" | 9 #include "include/v8-profiler.h" |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // embedder gets a null pointer instead. | 106 // embedder gets a null pointer instead. |
| 107 PHANTOM_WEAK, | 107 PHANTOM_WEAK, |
| 108 PHANTOM_WEAK_2_INTERNAL_FIELDS, | 108 PHANTOM_WEAK_2_INTERNAL_FIELDS, |
| 109 // The handle is automatically reset by the garbage collector when | 109 // The handle is automatically reset by the garbage collector when |
| 110 // the object is no longer reachable. | 110 // the object is no longer reachable. |
| 111 PHANTOM_WEAK_RESET_HANDLE | 111 PHANTOM_WEAK_RESET_HANDLE |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 class GlobalHandles { | 114 class GlobalHandles { |
| 115 public: | 115 public: |
| 116 enum IterationMode { HANDLE_PHANTOM_NODES, DONT_HANDLE_PHANTOM_NODES }; |
| 117 |
| 116 ~GlobalHandles(); | 118 ~GlobalHandles(); |
| 117 | 119 |
| 118 // Creates a new global handle that is alive until Destroy is called. | 120 // Creates a new global handle that is alive until Destroy is called. |
| 119 Handle<Object> Create(Object* value); | 121 Handle<Object> Create(Object* value); |
| 120 | 122 |
| 121 // Copy a global handle | 123 // Copy a global handle |
| 122 static Handle<Object> CopyGlobal(Object** location); | 124 static Handle<Object> CopyGlobal(Object** location); |
| 123 | 125 |
| 124 // Destroy a global handle. | 126 // Destroy a global handle. |
| 125 static void Destroy(Object** location); | 127 static void Destroy(Object** location); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // See the note above. | 222 // See the note above. |
| 221 void IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v); | 223 void IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v); |
| 222 | 224 |
| 223 // Finds weak independent or unmodified handles satisfying | 225 // Finds weak independent or unmodified handles satisfying |
| 224 // the callback predicate and marks them as pending. See the note above. | 226 // the callback predicate and marks them as pending. See the note above. |
| 225 void MarkNewSpaceWeakUnmodifiedObjectsPending( | 227 void MarkNewSpaceWeakUnmodifiedObjectsPending( |
| 226 WeakSlotCallbackWithHeap is_unscavenged); | 228 WeakSlotCallbackWithHeap is_unscavenged); |
| 227 | 229 |
| 228 // Iterates over weak independent or unmodified handles. | 230 // Iterates over weak independent or unmodified handles. |
| 229 // See the note above. | 231 // See the note above. |
| 232 template <IterationMode mode> |
| 230 void IterateNewSpaceWeakUnmodifiedRoots(ObjectVisitor* v); | 233 void IterateNewSpaceWeakUnmodifiedRoots(ObjectVisitor* v); |
| 231 | 234 |
| 235 void ResetNewSpaceHandlesForTesting(); |
| 236 |
| 232 // Identify unmodified objects that are in weak state and marks them | 237 // Identify unmodified objects that are in weak state and marks them |
| 233 // unmodified | 238 // unmodified |
| 234 void IdentifyWeakUnmodifiedObjects(WeakSlotCallback is_unmodified); | 239 void IdentifyWeakUnmodifiedObjects(WeakSlotCallback is_unmodified); |
| 235 | 240 |
| 236 // Iterate over objects in object groups that have at least one object | 241 // Iterate over objects in object groups that have at least one object |
| 237 // which requires visiting. The callback has to return true if objects | 242 // which requires visiting. The callback has to return true if objects |
| 238 // can be skipped and false otherwise. | 243 // can be skipped and false otherwise. |
| 239 bool IterateObjectGroups(ObjectVisitor* v, WeakSlotCallbackWithHeap can_skip); | 244 bool IterateObjectGroups(ObjectVisitor* v, WeakSlotCallbackWithHeap can_skip); |
| 240 | 245 |
| 241 // Print all objects in object groups | 246 // Print all objects in object groups |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; | 458 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; |
| 454 | 459 |
| 455 DISALLOW_COPY_AND_ASSIGN(EternalHandles); | 460 DISALLOW_COPY_AND_ASSIGN(EternalHandles); |
| 456 }; | 461 }; |
| 457 | 462 |
| 458 | 463 |
| 459 } // namespace internal | 464 } // namespace internal |
| 460 } // namespace v8 | 465 } // namespace v8 |
| 461 | 466 |
| 462 #endif // V8_GLOBAL_HANDLES_H_ | 467 #endif // V8_GLOBAL_HANDLES_H_ |
| OLD | NEW |