Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: src/global-handles.cc

Issue 14175005: New GC related APIs: Implicit references. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Code review (mstarzinger) + test update Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/global-handles.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/global-handles.cc
diff --git a/src/global-handles.cc b/src/global-handles.cc
index 8058f350cdb96f14ec79b775d25e1ba2eb260548..a3e7f1e7c7141679a580a060370b15fe1bad8e62 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(ObjectGroupRepresentative(
+ 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,13 @@ void GlobalHandles::SetRetainedObjectInfo(UniqueId id,
}
+void GlobalHandles::SetObjectGroupRepresentative(
+ UniqueId id,
+ HeapObject** representative_object) {
+ representative_objects_.Add(
+ ObjectGroupRepresentative(id, representative_object));
+}
+
void GlobalHandles::AddImplicitReferences(HeapObject** parent,
Object*** children,
size_t length) {
@@ -880,8 +897,16 @@ 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) {
+ ASSERT(!Node::FromLocation(child)->is_independent());
+ 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();
}
« no previous file with comments | « src/global-handles.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698