Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: src/heap/heap.cc

Issue 2005173003: Immediatelly promote marked objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Really should concentrate more Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index ea25bdb69869208c12021b3c6ba1bf4e663efd56..52e639fbd714be63836eed05ac7c8889d1a3ec00 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1653,6 +1653,7 @@ void Heap::Scavenge() {
Address new_space_front = new_space_.ToSpaceStart();
promotion_queue_.Initialize();
+ PromotionMode promotion_mode = CurrentPromotionMode();
ScavengeVisitor scavenge_visitor(this);
if (FLAG_scavenge_reclaim_unmodified_objects) {
@@ -1670,7 +1671,7 @@ void Heap::Scavenge() {
// Copy objects reachable from the old generation.
TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_OLD_TO_NEW_POINTERS);
RememberedSet<OLD_TO_NEW>::Iterate(this, [this](Address addr) {
- return Scavenger::CheckAndScavengeObject(this, addr, DEFAULT_PROMOTION);
+ return Scavenger::CheckAndScavengeObject(this, addr);
});
RememberedSet<OLD_TO_NEW>::IterateTyped(
@@ -1681,7 +1682,7 @@ void Heap::Scavenge() {
// If we do not force promotion, then we need to clear
// old_to_new slots in dead code objects after mark-compact.
return Scavenger::CheckAndScavengeObject(
- this, reinterpret_cast<Address>(addr), FORCE_PROMOTION);
+ this, reinterpret_cast<Address>(addr));
});
});
}
@@ -1705,7 +1706,8 @@ void Heap::Scavenge() {
{
TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE);
- new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
+ new_space_front =
+ DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
}
if (FLAG_scavenge_reclaim_unmodified_objects) {
@@ -1714,12 +1716,14 @@ void Heap::Scavenge() {
isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots(
&scavenge_visitor);
- new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
+ new_space_front =
+ DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
} 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);
+ new_space_front =
+ DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
}
isolate()->global_handles()->RemoveObjectGroups();
isolate()->global_handles()->RemoveImplicitRefGroups();
@@ -1729,7 +1733,8 @@ void Heap::Scavenge() {
isolate()->global_handles()->IterateNewSpaceWeakIndependentRoots(
&scavenge_visitor);
- new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
+ new_space_front =
+ DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
}
UpdateNewSpaceReferencesInExternalStringTable(
@@ -1911,9 +1916,9 @@ void Heap::VisitExternalResources(v8::ExternalResourceVisitor* visitor) {
external_string_table_.Iterate(&external_string_table_visitor);
}
-
Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor,
- Address new_space_front) {
+ Address new_space_front,
+ PromotionMode promotion_mode) {
do {
SemiSpace::AssertValidRange(new_space_front, new_space_.top());
// The addresses new_space_front and new_space_.top() define a
@@ -1922,8 +1927,14 @@ Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor,
while (new_space_front != new_space_.top()) {
if (!Page::IsAlignedToPageSize(new_space_front)) {
HeapObject* object = HeapObject::FromAddress(new_space_front);
- new_space_front +=
- StaticScavengeVisitor::IterateBody(object->map(), object);
+ if (promotion_mode == PROMOTE_MARKED) {
+ new_space_front += StaticScavengeVisitor<PROMOTE_MARKED>::IterateBody(
+ object->map(), object);
+ } else {
+ new_space_front +=
+ StaticScavengeVisitor<DEFAULT_PROMOTION>::IterateBody(
+ object->map(), object);
+ }
} else {
new_space_front = Page::FromAllocationAreaAddress(new_space_front)
->next_page()
@@ -4689,8 +4700,8 @@ void Heap::IteratePromotedObjectPointers(HeapObject* object, Address start,
Object* target = *slot;
if (target->IsHeapObject()) {
if (Heap::InFromSpace(target)) {
- callback(reinterpret_cast<HeapObject**>(slot), HeapObject::cast(target),
- DEFAULT_PROMOTION);
+ callback(reinterpret_cast<HeapObject**>(slot),
+ HeapObject::cast(target));
Object* new_target = *slot;
if (InNewSpace(new_target)) {
SLOW_DCHECK(Heap::InToSpace(new_target));
@@ -5232,7 +5243,8 @@ V8_DECLARE_ONCE(initialize_gc_once);
static void InitializeGCOnce() {
Scavenger::Initialize();
- StaticScavengeVisitor::Initialize();
+ StaticScavengeVisitor<DEFAULT_PROMOTION>::Initialize();
+ StaticScavengeVisitor<PROMOTE_MARKED>::Initialize();
MarkCompactCollector::Initialize();
}
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698