Chromium Code Reviews| Index: src/global-handles.cc |
| =================================================================== |
| --- src/global-handles.cc (revision 7254) |
| +++ src/global-handles.cc (working copy) |
| @@ -554,16 +554,36 @@ |
| #endif |
| -void GlobalHandles::AddGroup(Object*** handles, |
| - size_t length, |
| - v8::RetainedObjectInfo* info) { |
| + |
| +void GlobalHandles::AddObjectGroup(Object*** handles, |
| + size_t length, |
| + v8::RetainedObjectInfo* info) { |
| ObjectGroup* new_entry = new ObjectGroup(length, info); |
| - for (size_t i = 0; i < length; ++i) |
| + for (size_t i = 0; i < length; ++i) { |
| new_entry->objects_.Add(handles[i]); |
| + } |
| object_groups_.Add(new_entry); |
| } |
| +List<ImplicitRefGroup*>* GlobalHandles::ImplicitRefGroups() { |
| + // Lazily initialize the list to avoid startup time static constructors. |
| + static List<ImplicitRefGroup*> groups(4); |
|
Vitaly Repeshko
2011/03/18 10:38:00
This must be made non-static. I'll fix.
|
| + return &groups; |
| +} |
| + |
| + |
| +void GlobalHandles::AddImplicitReferences(HeapObject* parent, |
| + Object*** children, |
| + size_t length) { |
| + ImplicitRefGroup* new_entry = new ImplicitRefGroup(parent, length); |
| + for (size_t i = 0; i < length; ++i) { |
| + new_entry->children_.Add(children[i]); |
| + } |
| + ImplicitRefGroups()->Add(new_entry); |
| +} |
| + |
| + |
| void GlobalHandles::RemoveObjectGroups() { |
| for (int i = 0; i< object_groups_.length(); i++) { |
| delete object_groups_.at(i); |
| @@ -571,4 +591,14 @@ |
| object_groups_.Clear(); |
| } |
| + |
| +void GlobalHandles::RemoveImplicitRefGroups() { |
| + List<ImplicitRefGroup*>* ref_groups = ImplicitRefGroups(); |
| + for (int i = 0; i< ref_groups->length(); i++) { |
| + delete ref_groups->at(i); |
| + } |
| + ref_groups->Clear(); |
| +} |
| + |
| + |
| } } // namespace v8::internal |