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

Unified Diff: src/incremental-marking.cc

Issue 7149016: Multi-page growing and shrinking new-space (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 6 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/incremental-marking.h ('k') | src/mark-compact.cc » ('j') | src/spaces.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/incremental-marking.cc
diff --git a/src/incremental-marking.cc b/src/incremental-marking.cc
index bcd5523796df6794ff86722fff5ecd2915b4df15..9f4314a94f2de0ea934c4952080a2a2226059d33 100644
--- a/src/incremental-marking.cc
+++ b/src/incremental-marking.cc
@@ -87,10 +87,8 @@ class IncrementalMarkingMarkingVisitor : public ObjectVisitor {
MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
if (mark_bit.data_only()) {
incremental_marking_->MarkBlackOrKeepGrey(mark_bit);
- } else {
- if (Marking::IsWhite(mark_bit)) {
- incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit);
- }
+ } else if (Marking::IsWhite(mark_bit)) {
+ incremental_marking_->WhiteToGreyAndPush(heap_object, mark_bit);
}
}
}
@@ -153,7 +151,7 @@ void IncrementalMarking::SetOldSpacePageFlags(MemoryChunk* chunk,
}
-void IncrementalMarking::SetNewSpacePageFlags(MemoryChunk* chunk,
+void IncrementalMarking::SetNewSpacePageFlags(NewSpacePage* chunk,
bool is_marking) {
chunk->SetFlag(MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING);
if (is_marking) {
@@ -161,6 +159,7 @@ void IncrementalMarking::SetNewSpacePageFlags(MemoryChunk* chunk,
} else {
chunk->ClearFlag(MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING);
}
+ chunk->SetFlag(MemoryChunk::SCAN_ON_SCAVENGE);
Vyacheslav Egorov (Chromium) 2011/06/14 11:52:55 I am not sure this should be here.
Erik Corry 2011/06/14 12:23:17 I think it's correct. Scan-on-scavenge means that
Lasse Reichstein 2011/06/14 14:13:03 Keeping it.
}
@@ -173,14 +172,22 @@ void IncrementalMarking::DeactivateWriteBarrierForSpace(PagedSpace* space) {
}
+void IncrementalMarking::DeactivateWriteBarrierForSpace(NewSpace* space) {
Erik Corry 2011/06/14 12:23:17 This should really be called 'DeactivateIncrementa
Lasse Reichstein 2011/06/14 14:13:03 search-and-replaced.
+ NewSpacePageIterator it(space->ToSpaceLow(), space->ToSpaceHigh());
+ while (it.has_next()) {
+ NewSpacePage* p = it.next();
+ SetNewSpacePageFlags(p, false);
+ }
+}
+
+
void IncrementalMarking::DeactivateWriteBarrier() {
DeactivateWriteBarrierForSpace(heap_->old_pointer_space());
DeactivateWriteBarrierForSpace(heap_->old_data_space());
DeactivateWriteBarrierForSpace(heap_->cell_space());
DeactivateWriteBarrierForSpace(heap_->map_space());
DeactivateWriteBarrierForSpace(heap_->code_space());
-
- SetNewSpacePageFlags(heap_->new_space()->ActivePage(), false);
+ DeactivateWriteBarrierForSpace(heap_->new_space());
LargePage* lop = heap_->lo_space()->first_page();
while (lop->is_valid()) {
@@ -200,6 +207,16 @@ void IncrementalMarking::ClearMarkbits(PagedSpace* space) {
}
+void IncrementalMarking::ClearMarkbits(NewSpace* space) {
+ NewSpacePageIterator it(space->ToSpaceLow(), space->ToSpaceHigh());
Vyacheslav Egorov (Chromium) 2011/06/14 11:52:55 I find iterator interface confusing as new space i
Erik Corry 2011/06/14 12:23:17 Agreed. It would make more sense if it just took
Lasse Reichstein 2011/06/14 14:13:03 Actually that's why I want a page iterator to iter
Lasse Reichstein 2011/06/14 14:13:03 Changed to use NewSpacePageIterator(space), which
+ while (it.has_next()) {
+ NewSpacePage* p = it.next();
+ p->markbits()->Clear();
+ SetNewSpacePageFlags(p, true);
+ }
+}
+
+
void IncrementalMarking::ClearMarkbits() {
// TODO(gc): Clear the mark bits in the sweeper.
ClearMarkbits(heap_->old_pointer_space());
@@ -207,9 +224,7 @@ void IncrementalMarking::ClearMarkbits() {
ClearMarkbits(heap_->cell_space());
ClearMarkbits(heap_->map_space());
ClearMarkbits(heap_->code_space());
- heap_->new_space()->ActivePage()->markbits()->Clear();
-
- SetNewSpacePageFlags(heap_->new_space()->ActivePage(), true);
+ ClearMarkbits(heap_->new_space());
LargePage* lop = heap_->lo_space()->first_page();
while (lop->is_valid()) {
@@ -230,13 +245,23 @@ void IncrementalMarking::VerifyMarkbitsAreClean(PagedSpace* space) {
}
+void IncrementalMarking::VerifyMarkbitsAreClean(NewSpace* space) {
+ NewSpacePageIterator it(space->ToSpaceLow(), space->ToSpaceHigh());
+
+ while (it.has_next()) {
+ NewSpacePage* p = it.next();
+ ASSERT(p->markbits()->IsClean());
+ }
+}
+
+
void IncrementalMarking::VerifyMarkbitsAreClean() {
VerifyMarkbitsAreClean(heap_->old_pointer_space());
VerifyMarkbitsAreClean(heap_->old_data_space());
VerifyMarkbitsAreClean(heap_->code_space());
VerifyMarkbitsAreClean(heap_->cell_space());
VerifyMarkbitsAreClean(heap_->map_space());
- ASSERT(heap_->new_space()->ActivePage()->markbits()->IsClean());
+ VerifyMarkbitsAreClean(heap_->new_space());
}
#endif
@@ -348,7 +373,11 @@ void IncrementalMarking::StartMarking() {
void IncrementalMarking::PrepareForScavenge() {
if (!IsMarking()) return;
- heap_->new_space()->InactivePage()->markbits()->Clear();
+ NewSpacePageIterator it(heap_->new_space()->FromSpaceLow(),
+ heap_->new_space()->FromSpaceHigh());
+ while (it.has_next()) {
+ it.next()->markbits()->Clear();
+ }
}
« no previous file with comments | « src/incremental-marking.h ('k') | src/mark-compact.cc » ('j') | src/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698