Fix predictable mode when job based sweeping is off.

BUG=
R=jarin@chromium.org

Review URL: https://codereview.chromium.org/697423002

Cr-Commit-Position: refs/heads/master@{#25113}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25113 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
hpayer@chromium.org 2014-11-04 15:20:09 +00:00
parent d6ca29ce4c
commit 751289fb3a
2 changed files with 8 additions and 6 deletions

View File

@ -456,7 +456,6 @@ class MarkCompactCollector::SweeperTask : public v8::Task {
void MarkCompactCollector::StartSweeperThreads() { void MarkCompactCollector::StartSweeperThreads() {
DCHECK(free_list_old_pointer_space_.get()->IsEmpty()); DCHECK(free_list_old_pointer_space_.get()->IsEmpty());
DCHECK(free_list_old_data_space_.get()->IsEmpty()); DCHECK(free_list_old_data_space_.get()->IsEmpty());
sweeping_in_progress_ = true;
V8::GetCurrentPlatform()->CallOnBackgroundThread( V8::GetCurrentPlatform()->CallOnBackgroundThread(
new SweeperTask(heap(), heap()->old_data_space()), new SweeperTask(heap(), heap()->old_data_space()),
v8::Platform::kShortRunningTask); v8::Platform::kShortRunningTask);
@ -471,13 +470,15 @@ void MarkCompactCollector::EnsureSweepingCompleted() {
// If sweeping is not completed or not running at all, we try to complete it // If sweeping is not completed or not running at all, we try to complete it
// here. // here.
if (!IsSweepingCompleted()) { if (FLAG_predictable || !IsSweepingCompleted()) {
SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0); SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0);
SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0); SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0);
} }
// Wait twice for both jobs. // Wait twice for both jobs.
pending_sweeper_jobs_semaphore_.Wait(); if (!FLAG_predictable) {
pending_sweeper_jobs_semaphore_.Wait(); pending_sweeper_jobs_semaphore_.Wait();
pending_sweeper_jobs_semaphore_.Wait();
}
ParallelSweepSpacesComplete(); ParallelSweepSpacesComplete();
sweeping_in_progress_ = false; sweeping_in_progress_ = false;
RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); RefillFreeList(heap()->paged_space(OLD_DATA_SPACE));
@ -4185,7 +4186,7 @@ void MarkCompactCollector::SweepSpaces() {
SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING);
SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING);
} }
sweeping_in_progress_ = true;
if (!FLAG_predictable) { if (!FLAG_predictable) {
StartSweeperThreads(); StartSweeperThreads();
} }

View File

@ -2569,7 +2569,8 @@ void PagedSpace::PrepareForMarkCompact() {
intptr_t PagedSpace::SizeOfObjects() { intptr_t PagedSpace::SizeOfObjects() {
DCHECK(heap()->mark_compact_collector()->sweeping_in_progress() || DCHECK(FLAG_predictable ||
heap()->mark_compact_collector()->sweeping_in_progress() ||
(unswept_free_bytes_ == 0)); (unswept_free_bytes_ == 0));
return Size() - unswept_free_bytes_ - (limit() - top()); return Size() - unswept_free_bytes_ - (limit() - top());
} }