sweeping_pending_ = false;
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE));
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE));
- heap()->FreeQueuedChunks();
}
}
}
+void MarkCompactCollector::FinalizeSweeping() {
+ ASSERT(sweeping_pending_ == false);
+ ReleaseEvacuationCandidates();
+ heap()->FreeQueuedChunks();
+}
+
+
void MarkCompactCollector::MarkInParallel() {
for (int i = 0; i < FLAG_marking_threads; i++) {
heap()->isolate()->marking_threads()[i]->StartMarking();
if (AreSweeperThreadsActivated() && FLAG_concurrent_sweeping) {
// Instead of waiting we could also abort the sweeper threads here.
WaitUntilSweepingCompleted();
+ FinalizeSweeping();
}
// Clear marking bits if incremental marking is aborted.
slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_);
ASSERT(migration_slots_buffer_ == NULL);
+}
+
+
+void MarkCompactCollector::ReleaseEvacuationCandidates() {
+ int npages = evacuation_candidates_.length();
for (int i = 0; i < npages; i++) {
Page* p = evacuation_candidates_[i];
if (!p->IsEvacuationCandidate()) continue;
void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {
space->set_was_swept_conservatively(sweeper == CONSERVATIVE ||
sweeper == LAZY_CONSERVATIVE ||
- sweeper == PARALLEL_CONSERVATIVE);
+ sweeper == PARALLEL_CONSERVATIVE ||
+ sweeper == CONCURRENT_CONSERVATIVE);
space->ClearStats();
PageIterator it(space);
lazy_sweeping_active = true;
break;
}
+ case CONCURRENT_CONSERVATIVE:
case PARALLEL_CONSERVATIVE: {
if (FLAG_gc_verbose) {
PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n",
#endif
SweeperType how_to_sweep =
FLAG_lazy_sweeping ? LAZY_CONSERVATIVE : CONSERVATIVE;
- if (AreSweeperThreadsActivated()) how_to_sweep = PARALLEL_CONSERVATIVE;
+ if (FLAG_parallel_sweeping) how_to_sweep = PARALLEL_CONSERVATIVE;
+ if (FLAG_concurrent_sweeping) how_to_sweep = CONCURRENT_CONSERVATIVE;
if (FLAG_expose_gc) how_to_sweep = CONSERVATIVE;
if (sweep_precisely_) how_to_sweep = PRECISE;
// Noncompacting collections simply sweep the spaces to clear the mark
SweepSpace(heap()->old_pointer_space(), how_to_sweep);
SweepSpace(heap()->old_data_space(), how_to_sweep);
- if (how_to_sweep == PARALLEL_CONSERVATIVE) {
+ if (how_to_sweep == PARALLEL_CONSERVATIVE ||
+ how_to_sweep == CONCURRENT_CONSERVATIVE) {
// TODO(hpayer): fix race with concurrent sweeper
StartSweeperThreads();
- if (FLAG_parallel_sweeping && !FLAG_concurrent_sweeping) {
- WaitUntilSweepingCompleted();
- }
+ }
+
+ if (how_to_sweep == PARALLEL_CONSERVATIVE) {
+ WaitUntilSweepingCompleted();
}
RemoveDeadInvalidatedCode();
// Deallocate unmarked objects and clear marked bits for marked objects.
heap_->lo_space()->FreeUnmarkedObjects();
+
+ if (how_to_sweep != CONCURRENT_CONSERVATIVE) {
+ FinalizeSweeping();
+ }
}