OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/spaces.h" | 5 #include "src/heap/spaces.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/full-codegen/full-codegen.h" | 9 #include "src/full-codegen/full-codegen.h" |
10 #include "src/heap/slots-buffer.h" | 10 #include "src/heap/slots-buffer.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 chunk->area_end_ = area_end; | 485 chunk->area_end_ = area_end; |
486 chunk->flags_ = 0; | 486 chunk->flags_ = 0; |
487 chunk->set_owner(owner); | 487 chunk->set_owner(owner); |
488 chunk->InitializeReservedMemory(); | 488 chunk->InitializeReservedMemory(); |
489 chunk->slots_buffer_ = NULL; | 489 chunk->slots_buffer_ = NULL; |
490 chunk->skip_list_ = NULL; | 490 chunk->skip_list_ = NULL; |
491 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; | 491 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; |
492 chunk->progress_bar_ = 0; | 492 chunk->progress_bar_ = 0; |
493 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); | 493 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); |
494 chunk->set_parallel_sweeping(SWEEPING_DONE); | 494 chunk->set_parallel_sweeping(SWEEPING_DONE); |
| 495 chunk->parallel_compaction_.SetValue(kCompactingDone); |
495 chunk->mutex_ = NULL; | 496 chunk->mutex_ = NULL; |
496 chunk->available_in_small_free_list_ = 0; | 497 chunk->available_in_small_free_list_ = 0; |
497 chunk->available_in_medium_free_list_ = 0; | 498 chunk->available_in_medium_free_list_ = 0; |
498 chunk->available_in_large_free_list_ = 0; | 499 chunk->available_in_large_free_list_ = 0; |
499 chunk->available_in_huge_free_list_ = 0; | 500 chunk->available_in_huge_free_list_ = 0; |
500 chunk->non_available_small_blocks_ = 0; | 501 chunk->non_available_small_blocks_ = 0; |
501 chunk->ResetLiveBytes(); | 502 chunk->ResetLiveBytes(); |
502 Bitmap::Clear(chunk); | 503 Bitmap::Clear(chunk); |
503 chunk->initialize_scan_on_scavenge(false); | 504 chunk->initialize_scan_on_scavenge(false); |
504 chunk->SetFlag(WAS_SWEPT); | 505 chunk->SetFlag(WAS_SWEPT); |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 intptr_t FreeList::Concatenate(FreeList* free_list) { | 2252 intptr_t FreeList::Concatenate(FreeList* free_list) { |
2252 intptr_t free_bytes = 0; | 2253 intptr_t free_bytes = 0; |
2253 free_bytes += small_list_.Concatenate(free_list->small_list()); | 2254 free_bytes += small_list_.Concatenate(free_list->small_list()); |
2254 free_bytes += medium_list_.Concatenate(free_list->medium_list()); | 2255 free_bytes += medium_list_.Concatenate(free_list->medium_list()); |
2255 free_bytes += large_list_.Concatenate(free_list->large_list()); | 2256 free_bytes += large_list_.Concatenate(free_list->large_list()); |
2256 free_bytes += huge_list_.Concatenate(free_list->huge_list()); | 2257 free_bytes += huge_list_.Concatenate(free_list->huge_list()); |
2257 return free_bytes; | 2258 return free_bytes; |
2258 } | 2259 } |
2259 | 2260 |
2260 | 2261 |
| 2262 void FreeList::Divide(FreeList** free_lists_to_fill, size_t num) { |
| 2263 DCHECK(num > 0); |
| 2264 int size = 0; |
| 2265 FreeSpace* space = nullptr; |
| 2266 size_t cnt = 0; |
| 2267 while ((space = small_list_.PickNodeFromList(&size)) != nullptr) { |
| 2268 free_lists_to_fill[cnt % num]->small_list_.Free(space, size); |
| 2269 cnt++; |
| 2270 } |
| 2271 while ((space = medium_list_.PickNodeFromList(&size)) != nullptr) { |
| 2272 free_lists_to_fill[cnt % num]->medium_list_.Free(space, size); |
| 2273 cnt++; |
| 2274 } |
| 2275 while ((space = large_list_.PickNodeFromList(&size)) != nullptr) { |
| 2276 free_lists_to_fill[cnt % num]->large_list_.Free(space, size); |
| 2277 cnt++; |
| 2278 } |
| 2279 while ((space = huge_list_.PickNodeFromList(&size)) != nullptr) { |
| 2280 free_lists_to_fill[cnt % num]->huge_list_.Free(space, size); |
| 2281 cnt++; |
| 2282 } |
| 2283 } |
| 2284 |
| 2285 |
2261 void FreeList::Reset() { | 2286 void FreeList::Reset() { |
2262 small_list_.Reset(); | 2287 small_list_.Reset(); |
2263 medium_list_.Reset(); | 2288 medium_list_.Reset(); |
2264 large_list_.Reset(); | 2289 large_list_.Reset(); |
2265 huge_list_.Reset(); | 2290 huge_list_.Reset(); |
2266 } | 2291 } |
2267 | 2292 |
2268 | 2293 |
2269 int FreeList::Free(Address start, int size_in_bytes) { | 2294 int FreeList::Free(Address start, int size_in_bytes) { |
2270 if (size_in_bytes == 0) return 0; | 2295 if (size_in_bytes == 0) return 0; |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 object->ShortPrint(); | 3209 object->ShortPrint(); |
3185 PrintF("\n"); | 3210 PrintF("\n"); |
3186 } | 3211 } |
3187 printf(" --------------------------------------\n"); | 3212 printf(" --------------------------------------\n"); |
3188 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3213 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3189 } | 3214 } |
3190 | 3215 |
3191 #endif // DEBUG | 3216 #endif // DEBUG |
3192 } // namespace internal | 3217 } // namespace internal |
3193 } // namespace v8 | 3218 } // namespace v8 |
OLD | NEW |