Commit 7a88f729 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Revert "Revert "Revert "Revert "[global-handles] Remove dead code""""

This reverts commit 682d5369.

Reason for revert: Didn't see that this was the Reland... now we should be in good state.

Original change's description:
> Revert "Revert "Revert "[global-handles] Remove dead code"""
> 
> This reverts commit c836a95e.
> 
> Reason for revert: I don't think this was related.
> 
> Original change's description:
> > Revert "Revert "[global-handles] Remove dead code""
> > 
> > This reverts commit 58020872.
> > 
> > Reason for revert: Turned out to be a bot issue, reverting the revert. 
> > 
> > Original change's description:
> > > Revert "[global-handles] Remove dead code"
> > > 
> > > This reverts commit e2890c19.
> > > 
> > > Reason for revert: Looks like this CL causes slowdown on multiple builders, Check tests timeout and raise exceptions on the bot. Possible it is a bot issue as well, see tracking bug - https://bugs.chromium.org/p/chromium/issues/detail?id=720606
> > > 
> > > Original change's description:
> > > > [global-handles] Remove dead code
> > > > 
> > > > Bug: chromium:720477
> > > > Change-Id: I090168c575c41b7038af5dfba6cd8973d1154c51
> > > > Reviewed-on: https://chromium-review.googlesource.com/501790
> > > > Reviewed-by: Hannes Payer <hpayer@chromium.org>
> > > > Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> > > > Cr-Commit-Position: refs/heads/master@{#45241}
> > > 
> > > TBR=hpayer@chromium.org,mlippautz@chromium.org,jochen@chromium.org
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > Bug: chromium:720477
> > > 
> > > Change-Id: I92f40d8c4dbfdb5208b3068648612e8c5b97fb20
> > > Reviewed-on: https://chromium-review.googlesource.com/502029
> > > Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
> > > Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
> > > Cr-Commit-Position: refs/heads/master@{#45243}
> > 
> > TBR=hpayer@chromium.org,gdeepti@chromium.org,mlippautz@chromium.org,jochen@chromium.org,v8-reviews@googlegroups.com
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > Bug: chromium:720477
> > 
> > Change-Id: I70e190e0c27074228a8128aa849e5a419af915e8
> > Reviewed-on: https://chromium-review.googlesource.com/502030
> > Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
> > Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#45244}
> 
> TBR=hpayer@chromium.org,gdeepti@chromium.org,mlippautz@chromium.org,jochen@chromium.org,v8-reviews@googlegroups.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> Bug: chromium:720477
> 
> Change-Id: If3e4abea51d87546e25076b906a4c91e5ccf947b
> Reviewed-on: https://chromium-review.googlesource.com/503007
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#45246}

TBR=hpayer@chromium.org,gdeepti@chromium.org,mlippautz@chromium.org,jochen@chromium.org,v8-reviews@googlegroups.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Bug: chromium:720477

Change-Id: Id7dc886cc20b3b36ca5bb643686fe4fe2e98a3a7
Reviewed-on: https://chromium-review.googlesource.com/503008Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45261}
parent 651c4e9a
...@@ -647,19 +647,6 @@ void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(RootVisitor* v) { ...@@ -647,19 +647,6 @@ void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(RootVisitor* v) {
} }
} }
void GlobalHandles::IdentifyNewSpaceWeakIndependentHandles(
WeakSlotCallbackWithHeap f) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
DCHECK(node->is_in_new_space_list());
if (node->is_independent() && node->IsWeak() &&
f(isolate_->heap(), node->location())) {
node->MarkPending();
}
}
}
void GlobalHandles::IterateNewSpaceWeakIndependentRoots(RootVisitor* v) { void GlobalHandles::IterateNewSpaceWeakIndependentRoots(RootVisitor* v) {
for (int i = 0; i < new_space_nodes_.length(); ++i) { for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i]; Node* node = new_space_nodes_[i];
...@@ -703,7 +690,6 @@ void GlobalHandles::MarkNewSpaceWeakUnmodifiedObjectsPending( ...@@ -703,7 +690,6 @@ void GlobalHandles::MarkNewSpaceWeakUnmodifiedObjectsPending(
} }
} }
template <GlobalHandles::IterationMode mode>
void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) { void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) {
for (int i = 0; i < new_space_nodes_.length(); ++i) { for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i]; Node* node = new_space_nodes_[i];
...@@ -712,36 +698,18 @@ void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) { ...@@ -712,36 +698,18 @@ void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) {
node->IsWeakRetainer()) { node->IsWeakRetainer()) {
// Pending weak phantom handles die immediately. Everything else survives. // Pending weak phantom handles die immediately. Everything else survives.
if (node->IsPendingPhantomResetHandle()) { if (node->IsPendingPhantomResetHandle()) {
if (mode == IterationMode::HANDLE_PHANTOM_NODES || node->ResetPhantomHandle();
mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { ++number_of_phantom_handle_resets_;
node->ResetPhantomHandle();
++number_of_phantom_handle_resets_;
}
} else if (node->IsPendingPhantomCallback()) { } else if (node->IsPendingPhantomCallback()) {
if (mode == IterationMode::HANDLE_PHANTOM_NODES || node->CollectPhantomCallbackData(isolate(),
mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { &pending_phantom_callbacks_);
node->CollectPhantomCallbackData(isolate(),
&pending_phantom_callbacks_);
}
} else { } else {
if (mode == IterationMode::VISIT_OTHERS || v->VisitRootPointer(Root::kGlobalHandles, node->location());
mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) {
v->VisitRootPointer(Root::kGlobalHandles, node->location());
}
} }
} }
} }
} }
template void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots<
GlobalHandles::HANDLE_PHANTOM_NODES>(RootVisitor* v);
template void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots<
GlobalHandles::VISIT_OTHERS>(RootVisitor* v);
template void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots<
GlobalHandles::HANDLE_PHANTOM_NODES_VISIT_OTHERS>(RootVisitor* v);
void GlobalHandles::InvokeSecondPassPhantomCallbacks( void GlobalHandles::InvokeSecondPassPhantomCallbacks(
List<PendingPhantomCallback>* callbacks, Isolate* isolate) { List<PendingPhantomCallback>* callbacks, Isolate* isolate) {
while (callbacks->length() != 0) { while (callbacks->length() != 0) {
...@@ -998,30 +966,6 @@ void GlobalHandles::IterateWeakRootsInNewSpaceWithClassIds( ...@@ -998,30 +966,6 @@ void GlobalHandles::IterateWeakRootsInNewSpaceWithClassIds(
} }
} }
int GlobalHandles::NumberOfWeakHandles() {
int count = 0;
for (NodeIterator it(this); !it.done(); it.Advance()) {
if (it.node()->IsWeakRetainer()) {
count++;
}
}
return count;
}
int GlobalHandles::NumberOfGlobalObjectWeakHandles() {
int count = 0;
for (NodeIterator it(this); !it.done(); it.Advance()) {
if (it.node()->IsWeakRetainer() &&
it.node()->object()->IsJSGlobalObject()) {
count++;
}
}
return count;
}
void GlobalHandles::RecordStats(HeapStats* stats) { void GlobalHandles::RecordStats(HeapStats* stats) {
*stats->global_handle_count = 0; *stats->global_handle_count = 0;
*stats->weak_global_handle_count = 0; *stats->weak_global_handle_count = 0;
...@@ -1081,9 +1025,7 @@ void GlobalHandles::Print() { ...@@ -1081,9 +1025,7 @@ void GlobalHandles::Print() {
#endif #endif
void GlobalHandles::TearDown() { void GlobalHandles::TearDown() {}
// TODO(1428): invoke weak callbacks.
}
EternalHandles::EternalHandles() : size_(0) { EternalHandles::EternalHandles() : size_(0) {
for (unsigned i = 0; i < arraysize(singleton_handles_); i++) { for (unsigned i = 0; i < arraysize(singleton_handles_); i++) {
......
...@@ -43,12 +43,6 @@ enum WeaknessType { ...@@ -43,12 +43,6 @@ enum WeaknessType {
class GlobalHandles { class GlobalHandles {
public: public:
enum IterationMode {
HANDLE_PHANTOM_NODES_VISIT_OTHERS,
VISIT_OTHERS,
HANDLE_PHANTOM_NODES
};
~GlobalHandles(); ~GlobalHandles();
// Creates a new global handle that is alive until Destroy is called. // Creates a new global handle that is alive until Destroy is called.
...@@ -85,13 +79,6 @@ class GlobalHandles { ...@@ -85,13 +79,6 @@ class GlobalHandles {
void RecordStats(HeapStats* stats); void RecordStats(HeapStats* stats);
// Returns the current number of weak handles.
int NumberOfWeakHandles();
// Returns the current number of weak handles to global objects.
// These handles are also included in NumberOfWeakHandles().
int NumberOfGlobalObjectWeakHandles();
// Returns the current number of handles to global objects. // Returns the current number of handles to global objects.
int global_handles_count() const { int global_handles_count() const {
return number_of_global_handles_; return number_of_global_handles_;
...@@ -158,10 +145,6 @@ class GlobalHandles { ...@@ -158,10 +145,6 @@ class GlobalHandles {
// Iterates over strong and dependent handles. See the node above. // Iterates over strong and dependent handles. See the node above.
void IterateNewSpaceStrongAndDependentRoots(RootVisitor* v); void IterateNewSpaceStrongAndDependentRoots(RootVisitor* v);
// Finds weak independent or partially independent handles satisfying
// the callback predicate and marks them as pending. See the note above.
void IdentifyNewSpaceWeakIndependentHandles(WeakSlotCallbackWithHeap f);
// Iterates over weak independent or partially independent handles. // Iterates over weak independent or partially independent handles.
// See the note above. // See the note above.
void IterateNewSpaceWeakIndependentRoots(RootVisitor* v); void IterateNewSpaceWeakIndependentRoots(RootVisitor* v);
...@@ -173,7 +156,6 @@ class GlobalHandles { ...@@ -173,7 +156,6 @@ class GlobalHandles {
// Iterates over weak independent or unmodified handles. // Iterates over weak independent or unmodified handles.
// See the note above. // See the note above.
template <IterationMode mode>
void IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v); void IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v);
// Identify unmodified objects that are in weak state and marks them // Identify unmodified objects that are in weak state and marks them
......
...@@ -1781,11 +1781,8 @@ void Heap::Scavenge() { ...@@ -1781,11 +1781,8 @@ void Heap::Scavenge() {
isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending(
&IsUnscavengedHeapObject); &IsUnscavengedHeapObject);
isolate() isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots(
->global_handles() &root_scavenge_visitor);
->IterateNewSpaceWeakUnmodifiedRoots<
GlobalHandles::HANDLE_PHANTOM_NODES_VISIT_OTHERS>(
&root_scavenge_visitor);
new_space_front = DoScavenge(new_space_front); new_space_front = DoScavenge(new_space_front);
UpdateNewSpaceReferencesInExternalStringTable( UpdateNewSpaceReferencesInExternalStringTable(
......
...@@ -2617,10 +2617,8 @@ void MinorMarkCompactCollector::MarkLiveObjects() { ...@@ -2617,10 +2617,8 @@ void MinorMarkCompactCollector::MarkLiveObjects() {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_GLOBAL_HANDLES); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_GLOBAL_HANDLES);
isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending(
&IsUnmarkedObjectForYoungGeneration); &IsUnmarkedObjectForYoungGeneration);
isolate() isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots(
->global_handles() &root_visitor);
->IterateNewSpaceWeakUnmodifiedRoots<
GlobalHandles::HANDLE_PHANTOM_NODES_VISIT_OTHERS>(&root_visitor);
ProcessMarkingDeque(); ProcessMarkingDeque();
} }
......
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