Commit 74a25d8e authored by hpayer@chromium.org's avatar hpayer@chromium.org

Wait for sweeper threads and finalize sweeping only if parallel/concurrent...

Wait for sweeper threads and finalize sweeping only if parallel/concurrent sweeping was in progress.

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13810 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4292356b
......@@ -550,16 +550,15 @@ void MarkCompactCollector::StartSweeperThreads() {
void MarkCompactCollector::WaitUntilSweepingCompleted() {
if (sweeping_pending_) {
for (int i = 0; i < FLAG_sweeper_threads; i++) {
heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread();
}
sweeping_pending_ = false;
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE));
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE));
heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes();
heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes();
ASSERT(sweeping_pending_ == true);
for (int i = 0; i < FLAG_sweeper_threads; i++) {
heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread();
}
sweeping_pending_ = false;
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE));
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE));
heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes();
heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes();
}
......@@ -908,7 +907,7 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) {
ASSERT(!FLAG_never_compact || !FLAG_always_compact);
if (AreSweeperThreadsActivated() && FLAG_concurrent_sweeping) {
if (IsConcurrentSweepingInProgress()) {
// Instead of waiting we could also abort the sweeper threads here.
WaitUntilSweepingCompleted();
FinalizeSweeping();
......
......@@ -2545,7 +2545,7 @@ void PagedSpace::EvictEvacuationCandidatesFromFreeLists() {
bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) {
MarkCompactCollector* collector = heap()->mark_compact_collector();
if (collector->AreSweeperThreadsActivated()) {
if (FLAG_concurrent_sweeping) {
if (collector->IsConcurrentSweepingInProgress()) {
if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) {
collector->WaitUntilSweepingCompleted();
collector->FinalizeSweeping();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment