Commit 58a75305 authored by mlippautz's avatar mlippautz Committed by Commit bot

[api] Remove marking persistents as partially dependent

Also remove the flag scavenge_reclaim_unmodified_objects which has been
defaulted to true for quite some time now.

BUG=chromium:651354

Review-Url: https://codereview.chromium.org/2486173002
Cr-Commit-Position: refs/heads/master@{#40878}
parent 3098e249
...@@ -573,18 +573,6 @@ template <class T> class PersistentBase { ...@@ -573,18 +573,6 @@ template <class T> class PersistentBase {
*/ */
V8_INLINE void MarkIndependent(); V8_INLINE void MarkIndependent();
/**
* Marks the reference to this object partially dependent. Partially dependent
* handles only depend on other partially dependent handles and these
* dependencies are provided through object groups. It provides a way to build
* smaller object groups for young objects that represent only a subset of all
* external dependencies. This mark is automatically cleared after each
* garbage collection.
*/
V8_INLINE V8_DEPRECATED(
"deprecated optimization, do not use partially dependent groups",
void MarkPartiallyDependent());
/** /**
* Marks the reference to this object as active. The scavenge garbage * Marks the reference to this object as active. The scavenge garbage
* collection should not reclaim the objects marked as active. * collection should not reclaim the objects marked as active.
...@@ -8326,7 +8314,6 @@ class Internals { ...@@ -8326,7 +8314,6 @@ class Internals {
static const int kNodeStateIsPendingValue = 3; static const int kNodeStateIsPendingValue = 3;
static const int kNodeStateIsNearDeathValue = 4; static const int kNodeStateIsNearDeathValue = 4;
static const int kNodeIsIndependentShift = 3; static const int kNodeIsIndependentShift = 3;
static const int kNodeIsPartiallyDependentShift = 4;
static const int kNodeIsActiveShift = 4; static const int kNodeIsActiveShift = 4;
static const int kJSObjectType = 0xbc; static const int kJSObjectType = 0xbc;
...@@ -8622,17 +8609,6 @@ void PersistentBase<T>::MarkIndependent() { ...@@ -8622,17 +8609,6 @@ void PersistentBase<T>::MarkIndependent() {
I::kNodeIsIndependentShift); I::kNodeIsIndependentShift);
} }
template <class T>
void PersistentBase<T>::MarkPartiallyDependent() {
typedef internal::Internals I;
if (this->IsEmpty()) return;
I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
true,
I::kNodeIsPartiallyDependentShift);
}
template <class T> template <class T>
void PersistentBase<T>::MarkActive() { void PersistentBase<T>::MarkActive() {
typedef internal::Internals I; typedef internal::Internals I;
......
...@@ -754,8 +754,6 @@ DEFINE_BOOL(verify_heap, false, "verify heap pointers before and after GC") ...@@ -754,8 +754,6 @@ DEFINE_BOOL(verify_heap, false, "verify heap pointers before and after GC")
#endif #endif
DEFINE_BOOL(move_object_start, true, "enable moving of object starts") DEFINE_BOOL(move_object_start, true, "enable moving of object starts")
DEFINE_BOOL(memory_reducer, true, "use memory reducer") DEFINE_BOOL(memory_reducer, true, "use memory reducer")
DEFINE_BOOL(scavenge_reclaim_unmodified_objects, true,
"remove unmodified and unreferenced objects")
DEFINE_INT(heap_growing_percent, 0, DEFINE_INT(heap_growing_percent, 0,
"specifies heap growing factor as (1 + heap_growing_percent/100)") "specifies heap growing factor as (1 + heap_growing_percent/100)")
......
...@@ -52,8 +52,6 @@ class GlobalHandles::Node { ...@@ -52,8 +52,6 @@ class GlobalHandles::Node {
STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue); STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue);
STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) == STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) ==
Internals::kNodeIsIndependentShift); Internals::kNodeIsIndependentShift);
STATIC_ASSERT(static_cast<int>(IsPartiallyDependent::kShift) ==
Internals::kNodeIsPartiallyDependentShift);
STATIC_ASSERT(static_cast<int>(IsActive::kShift) == STATIC_ASSERT(static_cast<int>(IsActive::kShift) ==
Internals::kNodeIsActiveShift); Internals::kNodeIsActiveShift);
} }
...@@ -66,11 +64,7 @@ class GlobalHandles::Node { ...@@ -66,11 +64,7 @@ class GlobalHandles::Node {
class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId;
index_ = 0; index_ = 0;
set_independent(false); set_independent(false);
if (FLAG_scavenge_reclaim_unmodified_objects) { set_active(false);
set_active(false);
} else {
set_partially_dependent(false);
}
set_in_new_space_list(false); set_in_new_space_list(false);
parameter_or_next_free_.next_free = NULL; parameter_or_next_free_.next_free = NULL;
weak_callback_ = NULL; weak_callback_ = NULL;
...@@ -92,11 +86,7 @@ class GlobalHandles::Node { ...@@ -92,11 +86,7 @@ class GlobalHandles::Node {
object_ = object; object_ = object;
class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId;
set_independent(false); set_independent(false);
if (FLAG_scavenge_reclaim_unmodified_objects) { set_active(false);
set_active(false);
} else {
set_partially_dependent(false);
}
set_state(NORMAL); set_state(NORMAL);
parameter_or_next_free_.parameter = NULL; parameter_or_next_free_.parameter = NULL;
weak_callback_ = NULL; weak_callback_ = NULL;
...@@ -116,11 +106,7 @@ class GlobalHandles::Node { ...@@ -116,11 +106,7 @@ class GlobalHandles::Node {
object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue); object_ = reinterpret_cast<Object*>(kGlobalHandleZapValue);
class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId; class_id_ = v8::HeapProfiler::kPersistentHandleNoClassId;
set_independent(false); set_independent(false);
if (FLAG_scavenge_reclaim_unmodified_objects) { set_active(false);
set_active(false);
} else {
set_partially_dependent(false);
}
weak_callback_ = NULL; weak_callback_ = NULL;
DecreaseBlockUses(); DecreaseBlockUses();
} }
...@@ -153,21 +139,10 @@ class GlobalHandles::Node { ...@@ -153,21 +139,10 @@ class GlobalHandles::Node {
flags_ = IsIndependent::update(flags_, v); flags_ = IsIndependent::update(flags_, v);
} }
bool is_partially_dependent() {
CHECK(!FLAG_scavenge_reclaim_unmodified_objects);
return IsPartiallyDependent::decode(flags_);
}
void set_partially_dependent(bool v) {
CHECK(!FLAG_scavenge_reclaim_unmodified_objects);
flags_ = IsPartiallyDependent::update(flags_, v);
}
bool is_active() { bool is_active() {
CHECK(FLAG_scavenge_reclaim_unmodified_objects);
return IsActive::decode(flags_); return IsActive::decode(flags_);
} }
void set_active(bool v) { void set_active(bool v) {
CHECK(FLAG_scavenge_reclaim_unmodified_objects);
flags_ = IsActive::update(flags_, v); flags_ = IsActive::update(flags_, v);
} }
...@@ -227,14 +202,6 @@ class GlobalHandles::Node { ...@@ -227,14 +202,6 @@ class GlobalHandles::Node {
set_independent(true); set_independent(true);
} }
void MarkPartiallyDependent() {
DCHECK(IsInUse());
if (GetGlobalHandles()->isolate()->heap()->InNewSpace(object_)) {
set_partially_dependent(true);
}
}
void clear_partially_dependent() { set_partially_dependent(false); }
// Callback accessor. // Callback accessor.
// TODO(svenpanne) Re-enable or nuke later. // TODO(svenpanne) Re-enable or nuke later.
// WeakReferenceCallback callback() { return callback_; } // WeakReferenceCallback callback() { return callback_; }
...@@ -398,7 +365,6 @@ class GlobalHandles::Node { ...@@ -398,7 +365,6 @@ class GlobalHandles::Node {
class IsIndependent : public BitField<bool, 3, 1> {}; class IsIndependent : public BitField<bool, 3, 1> {};
// The following two fields are mutually exclusive // The following two fields are mutually exclusive
class IsActive : public BitField<bool, 4, 1> {}; class IsActive : public BitField<bool, 4, 1> {};
class IsPartiallyDependent : public BitField<bool, 4, 1> {};
class IsInNewSpaceList : public BitField<bool, 5, 1> {}; class IsInNewSpaceList : public BitField<bool, 5, 1> {};
class NodeWeaknessType : public BitField<WeaknessType, 6, 2> {}; class NodeWeaknessType : public BitField<WeaknessType, 6, 2> {};
...@@ -642,12 +608,6 @@ void GlobalHandles::MarkIndependent(Object** location) { ...@@ -642,12 +608,6 @@ void GlobalHandles::MarkIndependent(Object** location) {
Node::FromLocation(location)->MarkIndependent(); Node::FromLocation(location)->MarkIndependent();
} }
void GlobalHandles::MarkPartiallyDependent(Object** location) {
Node::FromLocation(location)->MarkPartiallyDependent();
}
bool GlobalHandles::IsIndependent(Object** location) { bool GlobalHandles::IsIndependent(Object** location) {
return Node::FromLocation(location)->is_independent(); return Node::FromLocation(location)->is_independent();
} }
...@@ -694,18 +654,10 @@ void GlobalHandles::IdentifyWeakHandles(WeakSlotCallback f) { ...@@ -694,18 +654,10 @@ void GlobalHandles::IdentifyWeakHandles(WeakSlotCallback f) {
void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(ObjectVisitor* v) { void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(ObjectVisitor* 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];
if (FLAG_scavenge_reclaim_unmodified_objects) { if (node->IsStrongRetainer() ||
if (node->IsStrongRetainer() || (node->IsWeakRetainer() && !node->is_independent() &&
(node->IsWeakRetainer() && !node->is_independent() && node->is_active())) {
node->is_active())) { v->VisitPointer(node->location());
v->VisitPointer(node->location());
}
} else {
if (node->IsStrongRetainer() ||
(node->IsWeakRetainer() && !node->is_independent() &&
!node->is_partially_dependent())) {
v->VisitPointer(node->location());
}
} }
} }
} }
...@@ -716,8 +668,8 @@ void GlobalHandles::IdentifyNewSpaceWeakIndependentHandles( ...@@ -716,8 +668,8 @@ void GlobalHandles::IdentifyNewSpaceWeakIndependentHandles(
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];
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->IsWeak() &&
node->IsWeak() && f(isolate_->heap(), node->location())) { f(isolate_->heap(), node->location())) {
node->MarkPending(); node->MarkPending();
} }
} }
...@@ -728,8 +680,7 @@ void GlobalHandles::IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v) { ...@@ -728,8 +680,7 @@ void GlobalHandles::IterateNewSpaceWeakIndependentRoots(ObjectVisitor* 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];
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->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()) {
node->ResetPhantomHandle(); node->ResetPhantomHandle();
...@@ -968,18 +919,11 @@ int GlobalHandles::PostScavengeProcessing( ...@@ -968,18 +919,11 @@ int GlobalHandles::PostScavengeProcessing(
// to be // to be
// called between two global garbage collection callbacks which // called between two global garbage collection callbacks which
// are not called for minor collections. // are not called for minor collections.
if (FLAG_scavenge_reclaim_unmodified_objects) {
if (!node->is_independent() && (node->is_active())) { if (!node->is_independent() && (node->is_active())) {
node->set_active(false); node->set_active(false);
continue; continue;
} }
node->set_active(false); node->set_active(false);
} else {
if (!node->is_independent() && !node->is_partially_dependent()) {
continue;
}
node->clear_partially_dependent();
}
if (node->PostGarbageCollectionProcessing(isolate_)) { if (node->PostGarbageCollectionProcessing(isolate_)) {
if (initial_post_gc_processing_count != post_gc_processing_count_) { if (initial_post_gc_processing_count != post_gc_processing_count_) {
...@@ -1007,11 +951,7 @@ int GlobalHandles::PostMarkSweepProcessing( ...@@ -1007,11 +951,7 @@ int GlobalHandles::PostMarkSweepProcessing(
// the freed_nodes. // the freed_nodes.
continue; continue;
} }
if (FLAG_scavenge_reclaim_unmodified_objects) { it.node()->set_active(false);
it.node()->set_active(false);
} else {
it.node()->clear_partially_dependent();
}
if (it.node()->PostGarbageCollectionProcessing(isolate_)) { if (it.node()->PostGarbageCollectionProcessing(isolate_)) {
if (initial_post_gc_processing_count != post_gc_processing_count_) { if (initial_post_gc_processing_count != post_gc_processing_count_) {
// See the comment above. // See the comment above.
......
...@@ -167,9 +167,6 @@ class GlobalHandles { ...@@ -167,9 +167,6 @@ class GlobalHandles {
// Mark the reference to this object independent of any object group. // Mark the reference to this object independent of any object group.
static void MarkIndependent(Object** location); static void MarkIndependent(Object** location);
// Mark the reference to this object externaly unreachable.
static void MarkPartiallyDependent(Object** location);
static bool IsIndependent(Object** location); static bool IsIndependent(Object** location);
// Tells whether global handle is near death. // Tells whether global handle is near death.
......
...@@ -446,7 +446,6 @@ void GCTracer::PrintNVP() const { ...@@ -446,7 +446,6 @@ void GCTracer::PrintNVP() const {
"roots=%.2f " "roots=%.2f "
"code=%.2f " "code=%.2f "
"semispace=%.2f " "semispace=%.2f "
"object_groups=%.2f "
"external.prologue=%.2f " "external.prologue=%.2f "
"external.epilogue=%.2f " "external.epilogue=%.2f "
"external_weak_global_handles=%.2f " "external_weak_global_handles=%.2f "
...@@ -483,7 +482,6 @@ void GCTracer::PrintNVP() const { ...@@ -483,7 +482,6 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::SCAVENGER_ROOTS], current_.scopes[Scope::SCAVENGER_ROOTS],
current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES], current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES],
current_.scopes[Scope::SCAVENGER_SEMISPACE], current_.scopes[Scope::SCAVENGER_SEMISPACE],
current_.scopes[Scope::SCAVENGER_OBJECT_GROUPS],
current_.scopes[Scope::EXTERNAL_PROLOGUE], current_.scopes[Scope::EXTERNAL_PROLOGUE],
current_.scopes[Scope::EXTERNAL_EPILOGUE], current_.scopes[Scope::EXTERNAL_EPILOGUE],
current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES], current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES],
......
...@@ -80,7 +80,6 @@ enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; ...@@ -80,7 +80,6 @@ enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
F(MC_SWEEP_MAP) \ F(MC_SWEEP_MAP) \
F(MC_SWEEP_OLD) \ F(MC_SWEEP_OLD) \
F(SCAVENGER_CODE_FLUSH_CANDIDATES) \ F(SCAVENGER_CODE_FLUSH_CANDIDATES) \
F(SCAVENGER_OBJECT_GROUPS) \
F(SCAVENGER_OLD_TO_NEW_POINTERS) \ F(SCAVENGER_OLD_TO_NEW_POINTERS) \
F(SCAVENGER_ROOTS) \ F(SCAVENGER_ROOTS) \
F(SCAVENGER_SCAVENGE) \ F(SCAVENGER_SCAVENGE) \
......
...@@ -1633,10 +1633,8 @@ void Heap::Scavenge() { ...@@ -1633,10 +1633,8 @@ void Heap::Scavenge() {
ScavengeVisitor scavenge_visitor(this); ScavengeVisitor scavenge_visitor(this);
if (FLAG_scavenge_reclaim_unmodified_objects) { isolate()->global_handles()->IdentifyWeakUnmodifiedObjects(
isolate()->global_handles()->IdentifyWeakUnmodifiedObjects( &IsUnmodifiedHeapObject);
&IsUnmodifiedHeapObject);
}
{ {
// Copy roots. // Copy roots.
...@@ -1684,29 +1682,12 @@ void Heap::Scavenge() { ...@@ -1684,29 +1682,12 @@ void Heap::Scavenge() {
new_space_front = DoScavenge(&scavenge_visitor, new_space_front); new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
} }
if (FLAG_scavenge_reclaim_unmodified_objects) { isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending(
isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( &IsUnscavengedHeapObject);
&IsUnscavengedHeapObject);
isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots(
&scavenge_visitor);
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
} else {
TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_OBJECT_GROUPS);
while (isolate()->global_handles()->IterateObjectGroups(
&scavenge_visitor, &IsUnscavengedHeapObject)) {
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
}
isolate()->global_handles()->RemoveObjectGroups();
isolate()->global_handles()->RemoveImplicitRefGroups();
isolate()->global_handles()->IdentifyNewSpaceWeakIndependentHandles(
&IsUnscavengedHeapObject);
isolate()->global_handles()->IterateNewSpaceWeakIndependentRoots( isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots(
&scavenge_visitor); &scavenge_visitor);
new_space_front = DoScavenge(&scavenge_visitor, new_space_front); new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
}
UpdateNewSpaceReferencesInExternalStringTable( UpdateNewSpaceReferencesInExternalStringTable(
&UpdateNewSpaceReferenceInExternalStringTableEntry); &UpdateNewSpaceReferenceInExternalStringTableEntry);
......
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