Commit cfd27c55 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Move FreeList related code into heap/free-list.* files

This also removes unused free list classes.

Change-Id: I705ca3aca94e404cf388e6c9bac2ff9f3c38fe10
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2241525
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68322}
parent 45cc19bb
......@@ -2464,6 +2464,9 @@ v8_source_set("v8_base_without_compiler") {
"src/heap/factory.h",
"src/heap/finalization-registry-cleanup-task.cc",
"src/heap/finalization-registry-cleanup-task.h",
"src/heap/free-list-inl.h",
"src/heap/free-list.cc",
"src/heap/free-list.h",
"src/heap/gc-idle-time-handler.cc",
"src/heap/gc-idle-time-handler.h",
"src/heap/gc-tracer.cc",
......
......@@ -884,14 +884,6 @@ DEFINE_BOOL(
trace_allocations_origins, false,
"Show statistics about the origins of allocations. "
"Combine with --no-inline-new to track allocations from generated code")
DEFINE_INT(gc_freelist_strategy, 5,
"Freelist strategy to use: "
"0:FreeListLegacy. "
"1:FreeListFastAlloc. "
"2:FreeListMany. "
"3:FreeListManyCached. "
"4:FreeListManyCachedFastPath. "
"5:FreeListManyCachedOrigin. ")
DEFINE_INT(trace_allocation_stack_interval, -1,
"print stack trace after <n> free-list allocations")
......
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_HEAP_FREE_LIST_INL_H_
#define V8_HEAP_FREE_LIST_INL_H_
#include "src/heap/free-list.h"
#include "src/heap/spaces.h"
namespace v8 {
namespace internal {
bool FreeListCategory::is_linked(FreeList* owner) const {
return prev_ != nullptr || next_ != nullptr ||
owner->categories_[type_] == this;
}
void FreeListCategory::UpdateCountersAfterAllocation(size_t allocation_size) {
available_ -= allocation_size;
}
Page* FreeList::GetPageForCategoryType(FreeListCategoryType type) {
FreeListCategory* category_top = top(type);
if (category_top != nullptr) {
DCHECK(!category_top->top().is_null());
return Page::FromHeapObject(category_top->top());
} else {
return nullptr;
}
}
} // namespace internal
} // namespace v8
#endif // V8_HEAP_FREE_LIST_INL_H_
This diff is collapsed.
This diff is collapsed.
......@@ -134,53 +134,6 @@ MemoryChunk* OldGenerationMemoryChunkIterator::next() {
UNREACHABLE();
}
bool FreeListCategory::is_linked(FreeList* owner) const {
return prev_ != nullptr || next_ != nullptr ||
owner->categories_[type_] == this;
}
void FreeListCategory::UpdateCountersAfterAllocation(size_t allocation_size) {
available_ -= allocation_size;
}
Page* FreeList::GetPageForCategoryType(FreeListCategoryType type) {
FreeListCategory* category_top = top(type);
if (category_top != nullptr) {
DCHECK(!category_top->top().is_null());
return Page::FromHeapObject(category_top->top());
} else {
return nullptr;
}
}
Page* FreeListLegacy::GetPageForSize(size_t size_in_bytes) {
const int minimum_category =
static_cast<int>(SelectFreeListCategoryType(size_in_bytes));
Page* page = GetPageForCategoryType(kHuge);
if (!page && static_cast<int>(kLarge) >= minimum_category)
page = GetPageForCategoryType(kLarge);
if (!page && static_cast<int>(kMedium) >= minimum_category)
page = GetPageForCategoryType(kMedium);
if (!page && static_cast<int>(kSmall) >= minimum_category)
page = GetPageForCategoryType(kSmall);
if (!page && static_cast<int>(kTiny) >= minimum_category)
page = GetPageForCategoryType(kTiny);
if (!page && static_cast<int>(kTiniest) >= minimum_category)
page = GetPageForCategoryType(kTiniest);
return page;
}
Page* FreeListFastAlloc::GetPageForSize(size_t size_in_bytes) {
const int minimum_category =
static_cast<int>(SelectFreeListCategoryType(size_in_bytes));
Page* page = GetPageForCategoryType(kHuge);
if (!page && static_cast<int>(kLarge) >= minimum_category)
page = GetPageForCategoryType(kLarge);
if (!page && static_cast<int>(kMedium) >= minimum_category)
page = GetPageForCategoryType(kMedium);
return page;
}
AllocationResult LocalAllocationBuffer::AllocateRawAligned(
int size_in_bytes, AllocationAlignment alignment) {
Address current_top = allocation_info_.top();
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,6 +7,7 @@
#include "src/execution/vm-state-inl.h"
#include "src/heap/array-buffer-tracker-inl.h"
#include "src/heap/code-object-registry.h"
#include "src/heap/free-list-inl.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/invalidated-slots-inl.h"
#include "src/heap/mark-compact-inl.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment