Index: src/global-handles.h |
diff --git a/src/global-handles.h b/src/global-handles.h |
index 3bab4b8c0ac5e7fa973b4c22ebd2e303bfbbda60..3559c4054b2e875e108a6bc33f2c2ec5e8866e53 100644 |
--- a/src/global-handles.h |
+++ b/src/global-handles.h |
@@ -39,9 +39,6 @@ namespace internal { |
// At GC the destroyed global handles are removed from the free list |
// and deallocated. |
-// Callback function on handling weak global handles. |
-// typedef bool (*WeakSlotCallback)(Object** pointer); |
- |
// An object group is treated like a single JS object: if one of object in |
// the group is alive, all objects in the same group are considered alive. |
// An object group is used to simulate object relationship in a DOM tree. |
@@ -61,6 +58,24 @@ class ObjectGroup : public Malloced { |
}; |
+// An implicit references group consists of two parts: a parent object and |
+// a list of children objects. If the parent is alive, all the children |
+// are alive too. |
+class ImplicitRefGroup : public Malloced { |
+ public: |
+ ImplicitRefGroup() : children_(4) {} |
+ ImplicitRefGroup(HeapObject* parent, size_t capacity) |
+ : parent_(parent), |
+ children_(static_cast<int>(capacity)) { } |
+ |
+ HeapObject* parent_; |
+ List<Object**> children_; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(ImplicitRefGroup); |
+}; |
+ |
+ |
typedef void (*WeakReferenceGuest)(Object* object, void* parameter); |
class GlobalHandles : public AllStatic { |
@@ -128,17 +143,28 @@ class GlobalHandles : public AllStatic { |
static void IdentifyWeakHandles(WeakSlotCallback f); |
// Add an object group. |
- // Should only used in GC callback function before a collection. |
+ // Should be only used in GC callback function before a collection. |
// All groups are destroyed after a mark-compact collection. |
- static void AddGroup(Object*** handles, |
- size_t length, |
- v8::RetainedObjectInfo* info); |
+ static void AddObjectGroup(Object*** handles, |
+ size_t length, |
+ v8::RetainedObjectInfo* info); |
+ |
+ // Add an implicit references' group. |
+ // Should be only used in GC callback function before a collection. |
+ // All groups are destroyed after a mark-compact collection. |
+ static void AddImplicitReferences(HeapObject* parent, |
+ Object*** children, |
+ size_t length); |
// Returns the object groups. |
static List<ObjectGroup*>* ObjectGroups(); |
+ // Returns the implicit references' groups. |
+ static List<ImplicitRefGroup*>* ImplicitRefGroups(); |
+ |
// Remove bags, this should only happen after GC. |
static void RemoveObjectGroups(); |
+ static void RemoveImplicitRefGroups(); |
// Tear down the global handle structure. |
static void TearDown(); |