OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 new SweeperTask(heap(), heap()->old_pointer_space()), | 463 new SweeperTask(heap(), heap()->old_pointer_space()), |
464 v8::Platform::kShortRunningTask); | 464 v8::Platform::kShortRunningTask); |
465 } | 465 } |
466 | 466 |
467 | 467 |
468 void MarkCompactCollector::EnsureSweepingCompleted() { | 468 void MarkCompactCollector::EnsureSweepingCompleted() { |
469 DCHECK(sweeping_in_progress_ == true); | 469 DCHECK(sweeping_in_progress_ == true); |
470 | 470 |
471 // If sweeping is not completed or not running at all, we try to complete it | 471 // If sweeping is not completed or not running at all, we try to complete it |
472 // here. | 472 // here. |
473 if (FLAG_predictable || !IsSweepingCompleted()) { | 473 if (!FLAG_concurrent_sweeping || !IsSweepingCompleted()) { |
474 SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0); | 474 SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0); |
475 SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0); | 475 SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0); |
476 } | 476 } |
477 // Wait twice for both jobs. | 477 // Wait twice for both jobs. |
478 if (!FLAG_predictable) { | 478 if (FLAG_concurrent_sweeping) { |
479 pending_sweeper_jobs_semaphore_.Wait(); | 479 pending_sweeper_jobs_semaphore_.Wait(); |
480 pending_sweeper_jobs_semaphore_.Wait(); | 480 pending_sweeper_jobs_semaphore_.Wait(); |
481 } | 481 } |
482 ParallelSweepSpacesComplete(); | 482 ParallelSweepSpacesComplete(); |
483 sweeping_in_progress_ = false; | 483 sweeping_in_progress_ = false; |
484 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); | 484 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); |
485 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); | 485 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); |
486 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); | 486 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
487 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); | 487 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
488 | 488 |
(...skipping 3649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4138 // non-live objects. | 4138 // non-live objects. |
4139 { | 4139 { |
4140 GCTracer::Scope sweep_scope(heap()->tracer(), | 4140 GCTracer::Scope sweep_scope(heap()->tracer(), |
4141 GCTracer::Scope::MC_SWEEP_OLDSPACE); | 4141 GCTracer::Scope::MC_SWEEP_OLDSPACE); |
4142 { | 4142 { |
4143 SequentialSweepingScope scope(this); | 4143 SequentialSweepingScope scope(this); |
4144 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); | 4144 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); |
4145 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); | 4145 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); |
4146 } | 4146 } |
4147 sweeping_in_progress_ = true; | 4147 sweeping_in_progress_ = true; |
4148 if (!FLAG_predictable) { | 4148 if (FLAG_concurrent_sweeping) { |
4149 StartSweeperThreads(); | 4149 StartSweeperThreads(); |
4150 } | 4150 } |
4151 } | 4151 } |
4152 RemoveDeadInvalidatedCode(); | 4152 RemoveDeadInvalidatedCode(); |
4153 | 4153 |
4154 { | 4154 { |
4155 GCTracer::Scope sweep_scope(heap()->tracer(), | 4155 GCTracer::Scope sweep_scope(heap()->tracer(), |
4156 GCTracer::Scope::MC_SWEEP_CODE); | 4156 GCTracer::Scope::MC_SWEEP_CODE); |
4157 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); | 4157 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); |
4158 } | 4158 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4407 SlotsBuffer* buffer = *buffer_address; | 4407 SlotsBuffer* buffer = *buffer_address; |
4408 while (buffer != NULL) { | 4408 while (buffer != NULL) { |
4409 SlotsBuffer* next_buffer = buffer->next(); | 4409 SlotsBuffer* next_buffer = buffer->next(); |
4410 DeallocateBuffer(buffer); | 4410 DeallocateBuffer(buffer); |
4411 buffer = next_buffer; | 4411 buffer = next_buffer; |
4412 } | 4412 } |
4413 *buffer_address = NULL; | 4413 *buffer_address = NULL; |
4414 } | 4414 } |
4415 } | 4415 } |
4416 } // namespace v8::internal | 4416 } // namespace v8::internal |
OLD | NEW |