| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium 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 "platform/heap/HeapCompact.h" | 5 #include "platform/heap/HeapCompact.h" |
| 6 | 6 |
| 7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
| 8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
| 10 #include "platform/heap/SparseHeapBitmap.h" | 10 #include "platform/heap/SparseHeapBitmap.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 size_t arena_size = arena->ArenaSize(); | 377 size_t arena_size = arena->ArenaSize(); |
| 378 size_t free_list_size = arena->FreeListSize(); | 378 size_t free_list_size = arena->FreeListSize(); |
| 379 total_arena_size += arena_size; | 379 total_arena_size += arena_size; |
| 380 total_free_list_size += free_list_size; | 380 total_free_list_size += free_list_size; |
| 381 LOG_HEAP_FREELIST("%d: [%zu, %zu], ", i, arena_size, free_list_size); | 381 LOG_HEAP_FREELIST("%d: [%zu, %zu], ", i, arena_size, free_list_size); |
| 382 // TODO: be more discriminating and consider arena | 382 // TODO: be more discriminating and consider arena |
| 383 // load factor, effectiveness of past compactions etc. | 383 // load factor, effectiveness of past compactions etc. |
| 384 if (!arena_size) | 384 if (!arena_size) |
| 385 continue; | 385 continue; |
| 386 // Mark the arena as compactable. | 386 // Mark the arena as compactable. |
| 387 compactable_arenas_ |= (0x1u << (BlinkGC::kVector1ArenaIndex + i)); | 387 compactable_arenas_ |= 0x1u << i; |
| 388 } | 388 } |
| 389 LOG_HEAP_FREELIST("}\nTotal = %zu, Free = %zu\n", total_arena_size, | 389 LOG_HEAP_FREELIST("}\nTotal = %zu, Free = %zu\n", total_arena_size, |
| 390 total_free_list_size); | 390 total_free_list_size); |
| 391 | 391 |
| 392 // TODO(sof): consider smoothing the reported sizes. | 392 // TODO(sof): consider smoothing the reported sizes. |
| 393 free_list_size_ = total_free_list_size; | 393 free_list_size_ = total_free_list_size; |
| 394 } | 394 } |
| 395 | 395 |
| 396 void HeapCompact::FinishedArenaCompaction(NormalPageArena* arena, | 396 void HeapCompact::FinishedArenaCompaction(NormalPageArena* arena, |
| 397 size_t freed_pages, | 397 size_t freed_pages, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 Fixups().AddCompactingPage(page); | 458 Fixups().AddCompactingPage(page); |
| 459 } | 459 } |
| 460 | 460 |
| 461 bool HeapCompact::ScheduleCompactionGCForTesting(bool value) { | 461 bool HeapCompact::ScheduleCompactionGCForTesting(bool value) { |
| 462 bool current = force_compaction_gc_; | 462 bool current = force_compaction_gc_; |
| 463 force_compaction_gc_ = value; | 463 force_compaction_gc_ = value; |
| 464 return current; | 464 return current; |
| 465 } | 465 } |
| 466 | 466 |
| 467 } // namespace blink | 467 } // namespace blink |
| OLD | NEW |