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

This reverts commit 58020872dc.

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 e2890c19a7.
> 
> 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}
This commit is contained in:
Deepti Gandluri 2017-05-10 21:55:25 +00:00 committed by Commit Bot
parent 58020872dc
commit c836a95e87
4 changed files with 10 additions and 91 deletions

View File

@ -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 <GlobalHandles::IterationMode mode>
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<PendingPhantomCallback>* 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++) {

View File

@ -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 <IterationMode mode>
void IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v);
// Identify unmodified objects that are in weak state and marks them

View File

@ -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(

View File

@ -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();
}