From c836a95e87a9d8a13b057a3acf90c75650906a3e Mon Sep 17 00:00:00 2001 From: Deepti Gandluri Date: Wed, 10 May 2017 21:55:25 +0000 Subject: [PATCH] Revert "Revert "[global-handles] Remove dead code"" This reverts commit 58020872dce50cb53dcc8ce5be8cc0243c759e0c. 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 e2890c19a70376686f025119082cfad6676a2f7b. > > 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 > > Commit-Queue: Michael Lippautz > > 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 > Commit-Queue: Deepti Gandluri > 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 Commit-Queue: Deepti Gandluri Cr-Commit-Position: refs/heads/master@{#45244} --- src/global-handles.cc | 70 ++++------------------------------------ src/global-handles.h | 18 ----------- src/heap/heap.cc | 7 ++-- src/heap/mark-compact.cc | 6 ++-- 4 files changed, 10 insertions(+), 91 deletions(-) diff --git a/src/global-handles.cc b/src/global-handles.cc index a96e8e377c..305e9c29f3 100644 --- a/src/global-handles.cc +++ b/src/global-handles.cc @@ -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) { for (int i = 0; i < new_space_nodes_.length(); ++i) { Node* node = new_space_nodes_[i]; @@ -703,7 +690,6 @@ void GlobalHandles::MarkNewSpaceWeakUnmodifiedObjectsPending( } } -template void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) { for (int i = 0; i < new_space_nodes_.length(); ++i) { Node* node = new_space_nodes_[i]; @@ -712,36 +698,18 @@ void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) { node->IsWeakRetainer()) { // Pending weak phantom handles die immediately. Everything else survives. if (node->IsPendingPhantomResetHandle()) { - if (mode == IterationMode::HANDLE_PHANTOM_NODES || - mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { - node->ResetPhantomHandle(); - ++number_of_phantom_handle_resets_; - } + node->ResetPhantomHandle(); + ++number_of_phantom_handle_resets_; } else if (node->IsPendingPhantomCallback()) { - if (mode == IterationMode::HANDLE_PHANTOM_NODES || - mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { - node->CollectPhantomCallbackData(isolate(), - &pending_phantom_callbacks_); - } + node->CollectPhantomCallbackData(isolate(), + &pending_phantom_callbacks_); } else { - if (mode == IterationMode::VISIT_OTHERS || - mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { - v->VisitRootPointer(Root::kGlobalHandles, node->location()); - } + 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( List* callbacks, Isolate* isolate) { while (callbacks->length() != 0) { @@ -989,30 +957,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) { *stats->global_handle_count = 0; *stats->weak_global_handle_count = 0; @@ -1072,9 +1016,7 @@ void GlobalHandles::Print() { #endif -void GlobalHandles::TearDown() { - // TODO(1428): invoke weak callbacks. -} +void GlobalHandles::TearDown() {} EternalHandles::EternalHandles() : size_(0) { for (unsigned i = 0; i < arraysize(singleton_handles_); i++) { diff --git a/src/global-handles.h b/src/global-handles.h index 673f1547b9..f1993e6eef 100644 --- a/src/global-handles.h +++ b/src/global-handles.h @@ -43,12 +43,6 @@ enum WeaknessType { class GlobalHandles { public: - enum IterationMode { - HANDLE_PHANTOM_NODES_VISIT_OTHERS, - VISIT_OTHERS, - HANDLE_PHANTOM_NODES - }; - ~GlobalHandles(); // Creates a new global handle that is alive until Destroy is called. @@ -85,13 +79,6 @@ class GlobalHandles { 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. int global_handles_count() const { return number_of_global_handles_; @@ -156,10 +143,6 @@ class GlobalHandles { // Iterates over strong and dependent handles. See the node above. 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. // See the note above. void IterateNewSpaceWeakIndependentRoots(RootVisitor* v); @@ -171,7 +154,6 @@ class GlobalHandles { // Iterates over weak independent or unmodified handles. // See the note above. - template void IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v); // Identify unmodified objects that are in weak state and marks them diff --git a/src/heap/heap.cc b/src/heap/heap.cc index a7dfb80e5a..d3832a2b93 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -1781,11 +1781,8 @@ void Heap::Scavenge() { isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( &IsUnscavengedHeapObject); - isolate() - ->global_handles() - ->IterateNewSpaceWeakUnmodifiedRoots< - GlobalHandles::HANDLE_PHANTOM_NODES_VISIT_OTHERS>( - &root_scavenge_visitor); + isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots( + &root_scavenge_visitor); new_space_front = DoScavenge(new_space_front); UpdateNewSpaceReferencesInExternalStringTable( diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 24919521ff..909a6f35f1 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -2547,10 +2547,8 @@ void MinorMarkCompactCollector::MarkLiveObjects() { TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_GLOBAL_HANDLES); isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( &IsUnmarkedObjectForYoungGeneration); - isolate() - ->global_handles() - ->IterateNewSpaceWeakUnmodifiedRoots< - GlobalHandles::HANDLE_PHANTOM_NODES_VISIT_OTHERS>(&root_visitor); + isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots( + &root_visitor); ProcessMarkingDeque(); }