[heap] Simplify FreeList clearing friends.

Bug: v8:9093
Change-Id: I3e4187f8d47a8a6cf80cc2fa2d2b96d89628af35
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585738
Auto-Submit: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61042}
This commit is contained in:
Hannes Payer 2019-04-26 12:58:57 +02:00 committed by Commit Bot
parent 829ceb70d9
commit aad7b143a4
3 changed files with 5 additions and 13 deletions

View File

@ -3769,7 +3769,7 @@ void MarkCompactCollector::ReleaseEvacuationCandidates() {
}
void MarkCompactCollector::StartSweepSpace(PagedSpace* space) {
space->ClearStats();
space->ClearAllocatorState();
int will_be_swept = 0;
bool unused_page_present = false;

View File

@ -2941,7 +2941,7 @@ void FreeList::Reset() {
for (int i = kFirstCategory; i < kNumberOfCategories; i++) {
categories_[i] = nullptr;
}
ResetStats();
wasted_bytes_ = 0;
}
size_t FreeList::Free(Address start, size_t size_in_bytes, FreeMode mode) {

View File

@ -164,8 +164,6 @@ class FreeListCategory {
void Reset();
void ResetStats() { Reset(); }
void RepairFreeList(Heap* heap);
// Relinks the category into the currently owning free list. Requires that the
@ -1864,12 +1862,6 @@ class FreeList {
// Clear the free list.
void Reset();
void ResetStats() {
wasted_bytes_ = 0;
ForAllFreeListCategories(
[](FreeListCategory* category) { category->ResetStats(); });
}
// Return the number of bytes available on the free list.
size_t Available() {
size_t available = 0;
@ -2148,10 +2140,10 @@ class V8_EXPORT_PRIVATE PagedSpace
// The stats are rebuilt during sweeping by adding each page to the
// capacity and the size when it is encountered. As free spaces are
// discovered during the sweeping they are subtracted from the size and added
// to the available and wasted totals.
void ClearStats() {
// to the available and wasted totals. The free list is cleared as well.
void ClearAllocatorState() {
accounting_stats_.ClearSize();
free_list_.ResetStats();
free_list_.Reset();
}
// Available bytes without growing. These are the bytes on the free list.