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/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3851 if (max_pages > 0 && page_count >= max_pages) { | 3851 if (max_pages > 0 && page_count >= max_pages) { |
3852 break; | 3852 break; |
3853 } | 3853 } |
3854 } | 3854 } |
3855 return max_freed_overall; | 3855 return max_freed_overall; |
3856 } | 3856 } |
3857 | 3857 |
3858 | 3858 |
3859 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { | 3859 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { |
3860 int max_freed = 0; | 3860 int max_freed = 0; |
3861 if (page->TryLock()) { | 3861 if (page->mutex()->TryLock()) { |
3862 // If this page was already swept in the meantime, we can return here. | 3862 // If this page was already swept in the meantime, we can return here. |
3863 if (page->concurrent_sweeping_state().Value() != Page::kSweepingPending) { | 3863 if (page->concurrent_sweeping_state().Value() != Page::kSweepingPending) { |
3864 page->mutex()->Unlock(); | 3864 page->mutex()->Unlock(); |
3865 return 0; | 3865 return 0; |
3866 } | 3866 } |
3867 page->concurrent_sweeping_state().SetValue(Page::kSweepingInProgress); | 3867 page->concurrent_sweeping_state().SetValue(Page::kSweepingInProgress); |
3868 FreeList* free_list; | 3868 FreeList* free_list; |
3869 FreeList private_free_list(space); | 3869 FreeList private_free_list(space); |
3870 if (space->identity() == OLD_SPACE) { | 3870 if (space->identity() == OLD_SPACE) { |
3871 free_list = free_list_old_space_.get(); | 3871 free_list = free_list_old_space_.get(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4066 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4066 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4067 if (Marking::IsBlack(mark_bit)) { | 4067 if (Marking::IsBlack(mark_bit)) { |
4068 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 4068 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
4069 RecordRelocSlot(&rinfo, target); | 4069 RecordRelocSlot(&rinfo, target); |
4070 } | 4070 } |
4071 } | 4071 } |
4072 } | 4072 } |
4073 | 4073 |
4074 } // namespace internal | 4074 } // namespace internal |
4075 } // namespace v8 | 4075 } // namespace v8 |
OLD | NEW |