| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 new SweeperTask(heap(), heap()->old_pointer_space()), | 465 new SweeperTask(heap(), heap()->old_pointer_space()), |
| 466 v8::Platform::kShortRunningTask); | 466 v8::Platform::kShortRunningTask); |
| 467 } | 467 } |
| 468 | 468 |
| 469 | 469 |
| 470 void MarkCompactCollector::EnsureSweepingCompleted() { | 470 void MarkCompactCollector::EnsureSweepingCompleted() { |
| 471 DCHECK(sweeping_in_progress_ == true); | 471 DCHECK(sweeping_in_progress_ == true); |
| 472 | 472 |
| 473 // If sweeping is not completed or not running at all, we try to complete it | 473 // If sweeping is not completed or not running at all, we try to complete it |
| 474 // here. | 474 // here. |
| 475 if (!FLAG_concurrent_sweeping || !IsSweepingCompleted()) { | 475 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { |
| 476 SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0); | 476 SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0); |
| 477 SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0); | 477 SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0); |
| 478 } | 478 } |
| 479 // Wait twice for both jobs. | 479 // Wait twice for both jobs. |
| 480 if (FLAG_concurrent_sweeping) { | 480 if (heap()->concurrent_sweeping_enabled()) { |
| 481 pending_sweeper_jobs_semaphore_.Wait(); | 481 pending_sweeper_jobs_semaphore_.Wait(); |
| 482 pending_sweeper_jobs_semaphore_.Wait(); | 482 pending_sweeper_jobs_semaphore_.Wait(); |
| 483 } | 483 } |
| 484 ParallelSweepSpacesComplete(); | 484 ParallelSweepSpacesComplete(); |
| 485 sweeping_in_progress_ = false; | 485 sweeping_in_progress_ = false; |
| 486 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); | 486 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); |
| 487 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); | 487 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); |
| 488 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); | 488 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
| 489 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); | 489 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
| 490 | 490 |
| (...skipping 3740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4231 // the other spaces rely on possibly non-live maps to get the sizes for | 4231 // the other spaces rely on possibly non-live maps to get the sizes for |
| 4232 // non-live objects. | 4232 // non-live objects. |
| 4233 { | 4233 { |
| 4234 GCTracer::Scope sweep_scope(heap()->tracer(), | 4234 GCTracer::Scope sweep_scope(heap()->tracer(), |
| 4235 GCTracer::Scope::MC_SWEEP_OLDSPACE); | 4235 GCTracer::Scope::MC_SWEEP_OLDSPACE); |
| 4236 { | 4236 { |
| 4237 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); | 4237 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); |
| 4238 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); | 4238 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); |
| 4239 } | 4239 } |
| 4240 sweeping_in_progress_ = true; | 4240 sweeping_in_progress_ = true; |
| 4241 if (FLAG_concurrent_sweeping) { | 4241 if (heap()->concurrent_sweeping_enabled()) { |
| 4242 StartSweeperThreads(); | 4242 StartSweeperThreads(); |
| 4243 } | 4243 } |
| 4244 } | 4244 } |
| 4245 RemoveDeadInvalidatedCode(); | 4245 RemoveDeadInvalidatedCode(); |
| 4246 | 4246 |
| 4247 { | 4247 { |
| 4248 GCTracer::Scope sweep_scope(heap()->tracer(), | 4248 GCTracer::Scope sweep_scope(heap()->tracer(), |
| 4249 GCTracer::Scope::MC_SWEEP_CODE); | 4249 GCTracer::Scope::MC_SWEEP_CODE); |
| 4250 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); | 4250 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); |
| 4251 } | 4251 } |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4519 SlotsBuffer* buffer = *buffer_address; | 4519 SlotsBuffer* buffer = *buffer_address; |
| 4520 while (buffer != NULL) { | 4520 while (buffer != NULL) { |
| 4521 SlotsBuffer* next_buffer = buffer->next(); | 4521 SlotsBuffer* next_buffer = buffer->next(); |
| 4522 DeallocateBuffer(buffer); | 4522 DeallocateBuffer(buffer); |
| 4523 buffer = next_buffer; | 4523 buffer = next_buffer; |
| 4524 } | 4524 } |
| 4525 *buffer_address = NULL; | 4525 *buffer_address = NULL; |
| 4526 } | 4526 } |
| 4527 } | 4527 } |
| 4528 } // namespace v8::internal | 4528 } // namespace v8::internal |
| OLD | NEW |