| 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 4145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4156 } | 4156 } |
| 4157 max_freed_overall = Max(max_freed, max_freed_overall); | 4157 max_freed_overall = Max(max_freed, max_freed_overall); |
| 4158 if (p == space->end_of_unswept_pages()) break; | 4158 if (p == space->end_of_unswept_pages()) break; |
| 4159 } | 4159 } |
| 4160 return max_freed_overall; | 4160 return max_freed_overall; |
| 4161 } | 4161 } |
| 4162 | 4162 |
| 4163 | 4163 |
| 4164 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { | 4164 int MarkCompactCollector::SweepInParallel(Page* page, PagedSpace* space) { |
| 4165 int max_freed = 0; | 4165 int max_freed = 0; |
| 4166 if (page->TryParallelSweeping()) { | 4166 if (page->TryLock()) { |
| 4167 // If this page was already swept in the meantime, we can return here. |
| 4168 if (page->parallel_sweeping() != MemoryChunk::SWEEPING_PENDING) { |
| 4169 page->mutex()->Unlock(); |
| 4170 return 0; |
| 4171 } |
| 4172 page->set_parallel_sweeping(MemoryChunk::SWEEPING_IN_PROGRESS); |
| 4167 FreeList* free_list = free_list_old_space_.get(); | 4173 FreeList* free_list = free_list_old_space_.get(); |
| 4168 FreeList private_free_list(space); | 4174 FreeList private_free_list(space); |
| 4169 max_freed = Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, IGNORE_SKIP_LIST, | 4175 max_freed = Sweep<SWEEP_ONLY, SWEEP_IN_PARALLEL, IGNORE_SKIP_LIST, |
| 4170 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); | 4176 IGNORE_FREE_SPACE>(space, &private_free_list, page, NULL); |
| 4171 free_list->Concatenate(&private_free_list); | 4177 free_list->Concatenate(&private_free_list); |
| 4178 page->mutex()->Unlock(); |
| 4172 } | 4179 } |
| 4173 return max_freed; | 4180 return max_freed; |
| 4174 } | 4181 } |
| 4175 | 4182 |
| 4176 | 4183 |
| 4177 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { | 4184 void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
| 4178 space->ClearStats(); | 4185 space->ClearStats(); |
| 4179 | 4186 |
| 4180 // We defensively initialize end_of_unswept_pages_ here with the first page | 4187 // We defensively initialize end_of_unswept_pages_ here with the first page |
| 4181 // of the pages list. | 4188 // of the pages list. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4642 SlotsBuffer* buffer = *buffer_address; | 4649 SlotsBuffer* buffer = *buffer_address; |
| 4643 while (buffer != NULL) { | 4650 while (buffer != NULL) { |
| 4644 SlotsBuffer* next_buffer = buffer->next(); | 4651 SlotsBuffer* next_buffer = buffer->next(); |
| 4645 DeallocateBuffer(buffer); | 4652 DeallocateBuffer(buffer); |
| 4646 buffer = next_buffer; | 4653 buffer = next_buffer; |
| 4647 } | 4654 } |
| 4648 *buffer_address = NULL; | 4655 *buffer_address = NULL; |
| 4649 } | 4656 } |
| 4650 } // namespace internal | 4657 } // namespace internal |
| 4651 } // namespace v8 | 4658 } // namespace v8 |
| OLD | NEW |