chromium/v8/src/heap/main-allocator.cc

// Copyright 2023 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.

#include "src/heap/main-allocator.h"

#include <optional>

#include "src/base/logging.h"
#include "src/common/globals.h"
#include "src/execution/vm-state-inl.h"
#include "src/execution/vm-state.h"
#include "src/heap/concurrent-marking.h"
#include "src/heap/free-list-inl.h"
#include "src/heap/gc-tracer-inl.h"
#include "src/heap/heap.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/main-allocator-inl.h"
#include "src/heap/new-spaces.h"
#include "src/heap/page-metadata-inl.h"
#include "src/heap/paged-spaces.h"
#include "src/heap/spaces.h"

namespace v8 {
namespace internal {

constexpr MainAllocator::BlackAllocation MainAllocator::ComputeBlackAllocation(
    MainAllocator::IsNewGeneration is_new_generation) {}

MainAllocator::MainAllocator(LocalHeap* local_heap, SpaceWithLinearArea* space,
                             IsNewGeneration is_new_generation,
                             LinearAllocationArea* allocation_info)
    :{}

MainAllocator::MainAllocator(Heap* heap, SpaceWithLinearArea* space, InGCTag)
    :{}

Address MainAllocator::AlignTopForTesting(AllocationAlignment alignment,
                                          int offset) {}

AllocationResult MainAllocator::AllocateRawForceAlignmentForTesting(
    int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin) {}

bool MainAllocator::IsBlackAllocationEnabled() const {}

void MainAllocator::AddAllocationObserver(AllocationObserver* observer) {}

void MainAllocator::RemoveAllocationObserver(AllocationObserver* observer) {}

void MainAllocator::PauseAllocationObservers() {}

void MainAllocator::ResumeAllocationObservers() {}

void MainAllocator::AdvanceAllocationObservers() {}

void MainAllocator::MarkLabStartInitialized() {}

// Perform an allocation step when the step is reached. size_in_bytes is the
// actual size needed for the object (required for InvokeAllocationObservers).
// aligned_size_in_bytes is the size of the object including the filler right
// before it to reach the right alignment (required to DCHECK the start of the
// object). allocation_size is the size of the actual allocation which needs to
// be used for the accounting. It can be different from aligned_size_in_bytes in
// PagedSpace::AllocateRawAligned, where we have to overallocate in order to be
// able to align the allocation afterwards.
void MainAllocator::InvokeAllocationObservers(Address soon_object,
                                              size_t size_in_bytes,
                                              size_t aligned_size_in_bytes,
                                              size_t allocation_size) {}

AllocationResult MainAllocator::AllocateRawSlow(int size_in_bytes,
                                                AllocationAlignment alignment,
                                                AllocationOrigin origin) {}

AllocationResult MainAllocator::AllocateRawSlowUnaligned(
    int size_in_bytes, AllocationOrigin origin) {}

AllocationResult MainAllocator::AllocateRawSlowAligned(
    int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin) {}

void MainAllocator::MakeLinearAllocationAreaIterable() {}

void MainAllocator::MarkLinearAllocationAreaBlack() {}

void MainAllocator::UnmarkLinearAllocationArea() {}

void MainAllocator::MoveOriginalTopForward() {}

void MainAllocator::ResetLab(Address start, Address end, Address extended_end) {}

bool MainAllocator::IsPendingAllocation(Address object_address) {}

bool MainAllocator::EnsureAllocation(int size_in_bytes,
                                     AllocationAlignment alignment,
                                     AllocationOrigin origin) {}

void MainAllocator::FreeLinearAllocationArea() {}

void MainAllocator::ExtendLAB(Address limit) {}

Address MainAllocator::ComputeLimit(Address start, Address end,
                                    size_t min_size) const {}

#if DEBUG
void MainAllocator::Verify() const {}
#endif  // DEBUG

bool MainAllocator::EnsureAllocationForTesting(int size_in_bytes,
                                               AllocationAlignment alignment,
                                               AllocationOrigin origin) {}

int MainAllocator::ObjectAlignment() const {}

AllocationSpace MainAllocator::identity() const {}

bool MainAllocator::is_main_thread() const {}

bool MainAllocator::in_gc_for_space() const {}

Heap* MainAllocator::space_heap() const {}

AllocatorPolicy::AllocatorPolicy(MainAllocator* allocator)
    :{}

Heap* AllocatorPolicy::space_heap() const {}

Heap* AllocatorPolicy::isolate_heap() const {}

bool SemiSpaceNewSpaceAllocatorPolicy::EnsureAllocation(
    int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin) {}

void SemiSpaceNewSpaceAllocatorPolicy::FreeLinearAllocationArea() {}

void SemiSpaceNewSpaceAllocatorPolicy::
    FreeLinearAllocationAreaUnsynchronized() {}

PagedNewSpaceAllocatorPolicy::PagedNewSpaceAllocatorPolicy(
    PagedNewSpace* space, MainAllocator* allocator)
    :{}

bool PagedNewSpaceAllocatorPolicy::EnsureAllocation(
    int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin) {}

bool PagedNewSpaceAllocatorPolicy::WaitForSweepingForAllocation(
    int size_in_bytes, AllocationOrigin origin) {}

namespace {
bool IsPagedNewSpaceAtFullCapacity(const PagedNewSpace* space) {}
}  // namespace

bool PagedNewSpaceAllocatorPolicy::TryAllocatePage(int size_in_bytes,
                                                   AllocationOrigin origin) {}

void PagedNewSpaceAllocatorPolicy::FreeLinearAllocationArea() {}

bool PagedSpaceAllocatorPolicy::EnsureAllocation(int size_in_bytes,
                                                 AllocationAlignment alignment,
                                                 AllocationOrigin origin) {}

bool PagedSpaceAllocatorPolicy::RefillLab(int size_in_bytes,
                                          AllocationOrigin origin) {}

bool PagedSpaceAllocatorPolicy::TryExpandAndAllocate(size_t size_in_bytes,
                                                     AllocationOrigin origin) {}

bool PagedSpaceAllocatorPolicy::ContributeToSweeping(uint32_t max_pages) {}

void PagedSpaceAllocatorPolicy::SetLinearAllocationArea(Address top,
                                                        Address limit,
                                                        Address end) {}

bool PagedSpaceAllocatorPolicy::TryAllocationFromFreeList(
    size_t size_in_bytes, AllocationOrigin origin) {}

bool PagedSpaceAllocatorPolicy::TryExtendLAB(int size_in_bytes) {}

void PagedSpaceAllocatorPolicy::FreeLinearAllocationArea() {}

void PagedSpaceAllocatorPolicy::FreeLinearAllocationAreaUnsynchronized() {}

}  // namespace internal
}  // namespace v8