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/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 void MarkCompactCollector::EnsureSweepingCompleted() { | 512 void MarkCompactCollector::EnsureSweepingCompleted() { |
513 DCHECK(sweeping_in_progress_ == true); | 513 DCHECK(sweeping_in_progress_ == true); |
514 | 514 |
515 // If sweeping is not completed or not running at all, we try to complete it | 515 // If sweeping is not completed or not running at all, we try to complete it |
516 // here. | 516 // here. |
517 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { | 517 if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) { |
518 SweepInParallel(heap()->paged_space(OLD_SPACE), 0); | 518 SweepInParallel(heap()->paged_space(OLD_SPACE), 0); |
519 SweepInParallel(heap()->paged_space(CODE_SPACE), 0); | 519 SweepInParallel(heap()->paged_space(CODE_SPACE), 0); |
520 SweepInParallel(heap()->paged_space(MAP_SPACE), 0); | 520 SweepInParallel(heap()->paged_space(MAP_SPACE), 0); |
521 } | 521 } |
522 // Wait twice for both jobs. | 522 |
523 if (heap()->concurrent_sweeping_enabled()) { | 523 if (heap()->concurrent_sweeping_enabled()) { |
524 pending_sweeper_jobs_semaphore_.Wait(); | 524 pending_sweeper_jobs_semaphore_.Wait(); |
525 pending_sweeper_jobs_semaphore_.Wait(); | 525 pending_sweeper_jobs_semaphore_.Wait(); |
526 pending_sweeper_jobs_semaphore_.Wait(); | 526 pending_sweeper_jobs_semaphore_.Wait(); |
527 } | 527 } |
| 528 |
| 529 heap()->WaitUntilUnmappingOfFreeChunksCompleted(); |
| 530 |
528 ParallelSweepSpacesComplete(); | 531 ParallelSweepSpacesComplete(); |
529 sweeping_in_progress_ = false; | 532 sweeping_in_progress_ = false; |
530 RefillFreeList(heap()->paged_space(OLD_SPACE)); | 533 RefillFreeList(heap()->paged_space(OLD_SPACE)); |
531 RefillFreeList(heap()->paged_space(CODE_SPACE)); | 534 RefillFreeList(heap()->paged_space(CODE_SPACE)); |
532 RefillFreeList(heap()->paged_space(MAP_SPACE)); | 535 RefillFreeList(heap()->paged_space(MAP_SPACE)); |
533 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); | 536 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); |
534 heap()->paged_space(CODE_SPACE)->ResetUnsweptFreeBytes(); | 537 heap()->paged_space(CODE_SPACE)->ResetUnsweptFreeBytes(); |
535 heap()->paged_space(MAP_SPACE)->ResetUnsweptFreeBytes(); | 538 heap()->paged_space(MAP_SPACE)->ResetUnsweptFreeBytes(); |
536 | 539 |
537 #ifdef VERIFY_HEAP | 540 #ifdef VERIFY_HEAP |
(...skipping 4155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4693 SlotsBuffer* buffer = *buffer_address; | 4696 SlotsBuffer* buffer = *buffer_address; |
4694 while (buffer != NULL) { | 4697 while (buffer != NULL) { |
4695 SlotsBuffer* next_buffer = buffer->next(); | 4698 SlotsBuffer* next_buffer = buffer->next(); |
4696 DeallocateBuffer(buffer); | 4699 DeallocateBuffer(buffer); |
4697 buffer = next_buffer; | 4700 buffer = next_buffer; |
4698 } | 4701 } |
4699 *buffer_address = NULL; | 4702 *buffer_address = NULL; |
4700 } | 4703 } |
4701 } // namespace internal | 4704 } // namespace internal |
4702 } // namespace v8 | 4705 } // namespace v8 |
OLD | NEW |