Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 0df3adcd9ebd1fd8b814813f9c7ee27248b5a099..12997ba8587a6274593be596d7a63f6320500e61 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -590,6 +590,15 @@ void MarkCompactCollector::StartSweeperThreads() { |
void MarkCompactCollector::WaitUntilSweepingCompleted() { |
Jarin
2014/07/11 07:40:52
Nit: WaitUntilSweepingCompleted -> EnsureSweepingC
Hannes Payer (out of office)
2014/07/11 09:36:13
Done.
|
ASSERT(sweeping_pending_ == true); |
+ |
+ // If sweeping is not completed, we try to complete it here. If we do not |
+ // have sweeper threads we have to complete since we do not have a good |
+ // indicator for a swept space in that case. |
+ if (!AreSweeperThreadsActivated() || !IsSweepingCompleted()) { |
+ SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0); |
+ SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0); |
+ } |
+ |
for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { |
isolate()->sweeper_threads()[i]->WaitForSweeperThread(); |
} |
@@ -613,6 +622,7 @@ bool MarkCompactCollector::IsSweepingCompleted() { |
return false; |
} |
} |
+ |
if (FLAG_job_based_sweeping) { |
if (!pending_sweeper_jobs_semaphore_.WaitFor( |
base::TimeDelta::FromSeconds(0))) { |
@@ -648,12 +658,6 @@ bool MarkCompactCollector::AreSweeperThreadsActivated() { |
} |
-bool MarkCompactCollector::IsConcurrentSweepingInProgress(PagedSpace* space) { |
- return (space == NULL || space->is_swept_concurrently()) && |
- sweeping_pending_; |
-} |
- |
- |
void Marking::TransferMark(Address old_start, Address new_start) { |
// This is only used when resizing an object. |
ASSERT(MemoryChunk::FromAddress(old_start) == |
@@ -959,7 +963,7 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) { |
ASSERT(!FLAG_never_compact || !FLAG_always_compact); |
- if (IsConcurrentSweepingInProgress()) { |
+ if (sweeping_pending()) { |
// Instead of waiting we could also abort the sweeper threads here. |
WaitUntilSweepingCompleted(); |
} |
@@ -4097,7 +4101,6 @@ int MarkCompactCollector::SweepInParallel(PagedSpace* space, |
void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
space->set_is_iterable(sweeper == PRECISE); |
- space->set_is_swept_concurrently(sweeper == CONCURRENT_CONSERVATIVE); |
space->ClearStats(); |
// We defensively initialize end_of_unswept_pages_ here with the first page |
@@ -4142,15 +4145,6 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
} |
switch (sweeper) { |
- case CONSERVATIVE: { |
- if (FLAG_gc_verbose) { |
- PrintF("Sweeping 0x%" V8PRIxPTR " conservatively.\n", |
- reinterpret_cast<intptr_t>(p)); |
- } |
- SweepConservatively<SWEEP_ON_MAIN_THREAD>(space, NULL, p); |
- pages_swept++; |
- break; |
- } |
case CONCURRENT_CONSERVATIVE: |
case PARALLEL_CONSERVATIVE: { |
if (!parallel_sweeping_active) { |
@@ -4212,11 +4206,10 @@ void MarkCompactCollector::SweepSpaces() { |
#ifdef DEBUG |
state_ = SWEEP_SPACES; |
#endif |
- SweeperType how_to_sweep = CONSERVATIVE; |
- if (AreSweeperThreadsActivated()) { |
- if (FLAG_parallel_sweeping) how_to_sweep = PARALLEL_CONSERVATIVE; |
- if (FLAG_concurrent_sweeping) how_to_sweep = CONCURRENT_CONSERVATIVE; |
- } |
+ SweeperType how_to_sweep = CONCURRENT_CONSERVATIVE; |
+ if (FLAG_parallel_sweeping) how_to_sweep = PARALLEL_CONSERVATIVE; |
+ if (FLAG_concurrent_sweeping) how_to_sweep = CONCURRENT_CONSERVATIVE; |
Jarin
2014/07/11 07:40:52
Is this is needed? CONCURRENT_CONSERVATIVE is the
Hannes Payer (out of office)
2014/07/11 09:36:13
I think it is good to initialize it.
|
+ |
if (sweep_precisely_) how_to_sweep = PRECISE; |
MoveEvacuationCandidatesToEndOfPagesList(); |