Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index 175390de852396c1f8db74de3fa496d0c16fa8eb..5d385b6257e45a0c6a17ab5a9f234ca4c4ff3a34 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -34,6 +34,7 @@ |
| #include "compilation-cache.h" |
| #include "debug.h" |
| #include "heap-profiler.h" |
| +#include "incremental-marking.h" |
| #include "global-handles.h" |
| #include "liveobjectlist-inl.h" |
| #include "mark-compact.h" |
| @@ -469,6 +470,14 @@ bool Heap::CollectGarbage(AllocationSpace space, GarbageCollector collector) { |
| allocation_timeout_ = Max(6, FLAG_gc_interval); |
| #endif |
| + if (collector == SCAVENGER && |
| + IncrementalMarking::state() != IncrementalMarking::STOPPED) { |
| + if (FLAG_trace_incremental_marking) { |
| + PrintF("[IncremenalMarker] SCAVENGE -> MARK-SWEEEP\n"); |
|
Erik Corry
2011/02/22 12:27:19
menal -> mental
SWEEEP -> SWEEP
Vyacheslav Egorov (Chromium)
2011/02/23 14:31:46
Done.
|
| + } |
| + collector = MARK_COMPACTOR; |
| + } |
| + |
| bool next_gc_likely_to_collect_more = false; |
| { GCTracer tracer; |
| @@ -491,6 +500,10 @@ bool Heap::CollectGarbage(AllocationSpace space, GarbageCollector collector) { |
| GarbageCollectionEpilogue(); |
| } |
| + ASSERT(IncrementalMarking::state() == IncrementalMarking::STOPPED); |
| + if (NextGCIsLikelyToBeFull() && FLAG_incremental_marking) { |
| + IncrementalMarking::Start(); |
| + } |
| #ifdef ENABLE_LOGGING_AND_PROFILING |
| if (FLAG_log_gc) HeapProfiler::WriteSample(); |
| @@ -503,7 +516,11 @@ bool Heap::CollectGarbage(AllocationSpace space, GarbageCollector collector) { |
| void Heap::PerformScavenge() { |
| GCTracer tracer; |
| - PerformGarbageCollection(SCAVENGER, &tracer); |
| + if (IncrementalMarking::state() == IncrementalMarking::STOPPED) { |
| + PerformGarbageCollection(SCAVENGER, &tracer); |
| + } else { |
| + PerformGarbageCollection(MARK_COMPACTOR, &tracer); |
| + } |
| } |