Commit f89bea1e authored by dcarney's avatar dcarney Committed by Commit bot

fix visiting of phantom handles that should be retained

BUG=

Review URL: https://codereview.chromium.org/1094473002

Cr-Commit-Position: refs/heads/master@{#27866}
parent 2e0cf578
...@@ -596,20 +596,12 @@ void GlobalHandles::IterateWeakRoots(ObjectVisitor* v) { ...@@ -596,20 +596,12 @@ void GlobalHandles::IterateWeakRoots(ObjectVisitor* v) {
for (NodeIterator it(this); !it.done(); it.Advance()) { for (NodeIterator it(this); !it.done(); it.Advance()) {
Node* node = it.node(); Node* node = it.node();
if (node->IsWeakRetainer()) { if (node->IsWeakRetainer()) {
// Weakness type can be normal or phantom, with or without internal // Pending weak phantom handles die immediately. Everything else survives.
// fields). For normal weakness we mark through the handle so that the if (node->state() == Node::PENDING &&
// object and things reachable from it are available to the callback. node->weakness_type() != NORMAL_WEAK) {
if (node->state() == Node::PENDING) {
if (node->weakness_type() == NORMAL_WEAK) {
v->VisitPointer(node->location());
} else {
node->CollectPhantomCallbackData(isolate(), node->CollectPhantomCallbackData(isolate(),
&pending_phantom_callbacks_); &pending_phantom_callbacks_);
}
} else { } 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()); v->VisitPointer(node->location());
} }
} }
...@@ -657,11 +649,13 @@ void GlobalHandles::IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v) { ...@@ -657,11 +649,13 @@ void GlobalHandles::IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v) {
DCHECK(node->is_in_new_space_list()); DCHECK(node->is_in_new_space_list());
if ((node->is_independent() || node->is_partially_dependent()) && if ((node->is_independent() || node->is_partially_dependent()) &&
node->IsWeakRetainer()) { node->IsWeakRetainer()) {
if (node->weakness_type() == NORMAL_WEAK) { // Pending weak phantom handles die immediately. Everything else survives.
v->VisitPointer(node->location()); if (node->state() == Node::PENDING &&
} else if (node->state() == Node::PENDING) { node->weakness_type() != NORMAL_WEAK) {
node->CollectPhantomCallbackData(isolate(), node->CollectPhantomCallbackData(isolate(),
&pending_phantom_callbacks_); &pending_phantom_callbacks_);
} else {
v->VisitPointer(node->location());
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment