Chromium Code Reviews| Index: src/global-handles.cc |
| diff --git a/src/global-handles.cc b/src/global-handles.cc |
| index 8058f350cdb96f14ec79b775d25e1ba2eb260548..47cdad17d016b7b7248f59e7ebe417ab99a4dbfe 100644 |
| --- a/src/global-handles.cc |
| +++ b/src/global-handles.cc |
| @@ -855,8 +855,18 @@ void GlobalHandles::AddObjectGroup(Object*** handles, |
| object_groups_.Add(ObjectGroupConnection( |
| UniqueId(reinterpret_cast<intptr_t>(handles[0])), handles[i])); |
| } |
| - retainer_infos_.Add(ObjectGroupRetainerInfo( |
| - UniqueId(reinterpret_cast<intptr_t>(handles[0])), info)); |
| + for (size_t i = 0; i < length; ++i) { |
| + if ((*handles[i])->IsHeapObject()) { |
| + representative_objects_.Add(ObjectGroupRepresentativeObject( |
| + UniqueId(reinterpret_cast<intptr_t>(handles[0])), |
| + reinterpret_cast<HeapObject**>(handles[i]))); |
| + break; |
| + } |
| + } |
| + if (info != NULL) { |
| + retainer_infos_.Add(ObjectGroupRetainerInfo( |
| + UniqueId(reinterpret_cast<intptr_t>(handles[0])), info)); |
| + } |
| } |
| void GlobalHandles::SetObjectGroupId(Object** handle, |
| @@ -871,6 +881,14 @@ void GlobalHandles::SetRetainedObjectInfo(UniqueId id, |
| } |
| +void GlobalHandles::SetRepresentativeObject( |
| + UniqueId id, |
| + HeapObject** representative_object) { |
| + representative_objects_.Add( |
| + ObjectGroupRepresentativeObject(id, representative_object)); |
| +} |
| + |
| + |
| void GlobalHandles::AddImplicitReferences(HeapObject** parent, |
| Object*** children, |
| size_t length) { |
| @@ -880,8 +898,15 @@ void GlobalHandles::AddImplicitReferences(HeapObject** parent, |
| ASSERT(!Node::FromLocation(children[i])->is_independent()); |
| } |
| #endif |
| - if (length == 0) return; |
| - implicit_ref_groups_.Add(ImplicitRefGroup::New(parent, children, length)); |
| + for (size_t i = 0; i < length; ++i) { |
| + implicit_ref_groups_.Add(ObjectGroupConnection( |
| + UniqueId(reinterpret_cast<intptr_t>(parent)), children[i])); |
| + } |
| +} |
| + |
| + |
| +void GlobalHandles::AddImplicitReference(UniqueId id, Object** child) { |
|
Michael Starzinger
2013/04/16 10:56:08
Can we add an assertion here to check that the chi
marja
2013/04/16 12:28:37
Done.
|
| + implicit_ref_groups_.Add(ObjectGroupConnection(id, child)); |
| } |
| @@ -896,9 +921,7 @@ void GlobalHandles::RemoveObjectGroups() { |
| void GlobalHandles::RemoveImplicitRefGroups() { |
| - for (int i = 0; i < implicit_ref_groups_.length(); i++) { |
| - implicit_ref_groups_.at(i)->Dispose(); |
| - } |
| + representative_objects_.Clear(); |
| implicit_ref_groups_.Clear(); |
| } |