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

Unified Diff: src/global-handles.cc

Issue 1094473002: fix visiting of phantom handles that should be retained (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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 75a824deb073109f305028d0787819fc8d8686d5..d8073aa65043cf6222fb0431ff1e1ea37a2b36df 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -596,20 +596,12 @@ void GlobalHandles::IterateWeakRoots(ObjectVisitor* v) {
for (NodeIterator it(this); !it.done(); it.Advance()) {
Node* node = it.node();
if (node->IsWeakRetainer()) {
- // Weakness type can be normal or phantom, with or without internal
- // fields). For normal weakness we mark through the handle so that the
- // object and things reachable from it are available to the callback.
- if (node->state() == Node::PENDING) {
- if (node->weakness_type() == NORMAL_WEAK) {
- v->VisitPointer(node->location());
- } else {
+ // Pending weak phantom handles die immediately. Everything else survives.
+ if (node->state() == Node::PENDING &&
+ node->weakness_type() != NORMAL_WEAK) {
node->CollectPhantomCallbackData(isolate(),
&pending_phantom_callbacks_);
- }
} else {
- // Node is not pending, so that means the object survived. We still
- // need to visit the pointer in case the object moved, eg. because of
- // compaction.
v->VisitPointer(node->location());
}
}
@@ -657,11 +649,13 @@ void GlobalHandles::IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v) {
DCHECK(node->is_in_new_space_list());
if ((node->is_independent() || node->is_partially_dependent()) &&
node->IsWeakRetainer()) {
- if (node->weakness_type() == NORMAL_WEAK) {
- v->VisitPointer(node->location());
- } else if (node->state() == Node::PENDING) {
+ // Pending weak phantom handles die immediately. Everything else survives.
+ if (node->state() == Node::PENDING &&
+ node->weakness_type() != NORMAL_WEAK) {
node->CollectPhantomCallbackData(isolate(),
&pending_phantom_callbacks_);
+ } else {
+ v->VisitPointer(node->location());
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698