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

Unified Diff: src/mark-compact.cc

Issue 8342037: Switch UnreachableObjectsFilter to use Marking instead of InstrusiveMarking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 9fa79ca74629a406ea6a27181bfa296c23f47cee..3f4d236a38a06b0205b11777d5b7709ca4f6eaa7 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -63,6 +63,7 @@ MarkCompactCollector::MarkCompactCollector() : // NOLINT
compacting_(false),
was_marked_incrementally_(false),
collect_maps_(FLAG_collect_maps),
+ markbits_are_tainted_(false),
tracer_(NULL),
migration_slots_buffer_(NULL),
#ifdef DEBUG
@@ -330,7 +331,7 @@ void MarkCompactCollector::VerifyMarkbitsAreClean() {
#endif
-static void ClearMarkbits(PagedSpace* space) {
+static void ClearMarkbitsInPagedSpace(PagedSpace* space) {
PageIterator it(space);
while (it.has_next()) {
@@ -339,7 +340,7 @@ static void ClearMarkbits(PagedSpace* space) {
}
-static void ClearMarkbits(NewSpace* space) {
+static void ClearMarkbitsInNewSpace(NewSpace* space) {
NewSpacePageIterator it(space->ToSpaceStart(), space->ToSpaceEnd());
while (it.has_next()) {
@@ -348,20 +349,24 @@ static void ClearMarkbits(NewSpace* space) {
}
-static void ClearMarkbits(Heap* heap) {
- ClearMarkbits(heap->code_space());
- ClearMarkbits(heap->map_space());
- ClearMarkbits(heap->old_pointer_space());
- ClearMarkbits(heap->old_data_space());
- ClearMarkbits(heap->cell_space());
- ClearMarkbits(heap->new_space());
+void MarkCompactCollector::ClearMarkbits() {
+ if (!markbits_are_tainted_) return;
- LargeObjectIterator it(heap->lo_space());
+ ClearMarkbitsInPagedSpace(heap()->code_space());
+ ClearMarkbitsInPagedSpace(heap()->map_space());
+ ClearMarkbitsInPagedSpace(heap()->old_pointer_space());
+ ClearMarkbitsInPagedSpace(heap()->old_data_space());
+ ClearMarkbitsInPagedSpace(heap()->cell_space());
+ ClearMarkbitsInNewSpace(heap()->new_space());
+
+ LargeObjectIterator it(heap()->lo_space());
for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
MarkBit mark_bit = Marking::MarkBitFrom(obj);
mark_bit.Clear();
mark_bit.Next().Clear();
}
+
+ markbits_are_tainted_ = false;
Erik Corry 2011/10/19 17:56:07 Here you could use SetMarkbitsTainted(false)
}
@@ -504,9 +509,9 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) {
// Clear marking bits for precise sweeping to collect all garbage.
if (was_marked_incrementally_ && PreciseSweepingRequired()) {
heap()->incremental_marking()->Abort();
- ClearMarkbits(heap_);
AbortCompaction();
was_marked_incrementally_ = false;
+ TaintMarkbits();
}
// Don't start compaction if we are in the middle of incremental
@@ -515,6 +520,8 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) {
StartCompaction();
}
+ ClearMarkbits();
+
PagedSpaces spaces;
for (PagedSpace* space = spaces.next();
space != NULL;
« src/mark-compact.h ('K') | « src/mark-compact.h ('k') | src/mark-compact-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698