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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 SweepInParallel(heap()->paged_space(CODE_SPACE), 0); | 543 SweepInParallel(heap()->paged_space(CODE_SPACE), 0); |
544 SweepInParallel(heap()->paged_space(MAP_SPACE), 0); | 544 SweepInParallel(heap()->paged_space(MAP_SPACE), 0); |
545 } | 545 } |
546 | 546 |
547 if (heap()->concurrent_sweeping_enabled()) { | 547 if (heap()->concurrent_sweeping_enabled()) { |
548 pending_sweeper_jobs_semaphore_.Wait(); | 548 pending_sweeper_jobs_semaphore_.Wait(); |
549 pending_sweeper_jobs_semaphore_.Wait(); | 549 pending_sweeper_jobs_semaphore_.Wait(); |
550 pending_sweeper_jobs_semaphore_.Wait(); | 550 pending_sweeper_jobs_semaphore_.Wait(); |
551 } | 551 } |
552 | 552 |
553 heap()->WaitUntilUnmappingOfFreeChunksCompleted(); | |
554 | |
555 ParallelSweepSpacesComplete(); | 553 ParallelSweepSpacesComplete(); |
556 sweeping_in_progress_ = false; | 554 sweeping_in_progress_ = false; |
557 RefillFreeList(heap()->paged_space(OLD_SPACE)); | 555 RefillFreeList(heap()->paged_space(OLD_SPACE)); |
558 RefillFreeList(heap()->paged_space(CODE_SPACE)); | 556 RefillFreeList(heap()->paged_space(CODE_SPACE)); |
559 RefillFreeList(heap()->paged_space(MAP_SPACE)); | 557 RefillFreeList(heap()->paged_space(MAP_SPACE)); |
560 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); | 558 heap()->paged_space(OLD_SPACE)->ResetUnsweptFreeBytes(); |
561 heap()->paged_space(CODE_SPACE)->ResetUnsweptFreeBytes(); | 559 heap()->paged_space(CODE_SPACE)->ResetUnsweptFreeBytes(); |
562 heap()->paged_space(MAP_SPACE)->ResetUnsweptFreeBytes(); | 560 heap()->paged_space(MAP_SPACE)->ResetUnsweptFreeBytes(); |
563 | 561 |
564 #ifdef VERIFY_HEAP | 562 #ifdef VERIFY_HEAP |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 state_ = PREPARE_GC; | 803 state_ = PREPARE_GC; |
806 #endif | 804 #endif |
807 | 805 |
808 DCHECK(!FLAG_never_compact || !FLAG_always_compact); | 806 DCHECK(!FLAG_never_compact || !FLAG_always_compact); |
809 | 807 |
810 if (sweeping_in_progress()) { | 808 if (sweeping_in_progress()) { |
811 // Instead of waiting we could also abort the sweeper threads here. | 809 // Instead of waiting we could also abort the sweeper threads here. |
812 EnsureSweepingCompleted(); | 810 EnsureSweepingCompleted(); |
813 } | 811 } |
814 | 812 |
| 813 // If concurrent unmapping tasks are still running, we should wait for |
| 814 // them here. |
| 815 heap()->WaitUntilUnmappingOfFreeChunksCompleted(); |
| 816 |
815 // Clear marking bits if incremental marking is aborted. | 817 // Clear marking bits if incremental marking is aborted. |
816 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) { | 818 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) { |
817 heap()->incremental_marking()->Stop(); | 819 heap()->incremental_marking()->Stop(); |
818 ClearMarkbits(); | 820 ClearMarkbits(); |
819 AbortWeakCollections(); | 821 AbortWeakCollections(); |
820 AbortWeakCells(); | 822 AbortWeakCells(); |
821 AbortCompaction(); | 823 AbortCompaction(); |
822 was_marked_incrementally_ = false; | 824 was_marked_incrementally_ = false; |
823 } | 825 } |
824 | 826 |
(...skipping 3917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4742 SlotsBuffer* buffer = *buffer_address; | 4744 SlotsBuffer* buffer = *buffer_address; |
4743 while (buffer != NULL) { | 4745 while (buffer != NULL) { |
4744 SlotsBuffer* next_buffer = buffer->next(); | 4746 SlotsBuffer* next_buffer = buffer->next(); |
4745 DeallocateBuffer(buffer); | 4747 DeallocateBuffer(buffer); |
4746 buffer = next_buffer; | 4748 buffer = next_buffer; |
4747 } | 4749 } |
4748 *buffer_address = NULL; | 4750 *buffer_address = NULL; |
4749 } | 4751 } |
4750 } // namespace internal | 4752 } // namespace internal |
4751 } // namespace v8 | 4753 } // namespace v8 |
OLD | NEW |