chromium/v8/src/utils/allocation.cc

// Copyright 2012 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/utils/allocation.h"

#include <stdlib.h>  // For free, malloc.

#include "src/base/bits.h"
#include "src/base/bounded-page-allocator.h"
#include "src/base/lazy-instance.h"
#include "src/base/logging.h"
#include "src/base/page-allocator.h"
#include "src/base/platform/memory.h"
#include "src/base/sanitizer/lsan-page-allocator.h"
#include "src/base/sanitizer/lsan-virtual-address-space.h"
#include "src/base/virtual-address-space.h"
#include "src/flags/flags.h"
#include "src/init/v8.h"
#include "src/sandbox/sandbox.h"
#include "src/utils/memcopy.h"

#if V8_LIBC_BIONIC
#include <malloc.h>
#endif

namespace v8 {
namespace internal {

namespace {

class PageAllocatorInitializer {};

DEFINE_LAZY_LEAKY_OBJECT_GETTER()

// We will attempt allocation this many times. After each failure, we call
// OnCriticalMemoryPressure to try to free some memory.
const int kAllocationTries =;

}  // namespace

v8::PageAllocator* GetPlatformPageAllocator() {}

v8::VirtualAddressSpace* GetPlatformVirtualAddressSpace() {}

#ifdef V8_ENABLE_SANDBOX
v8::PageAllocator* GetSandboxPageAllocator() {}
#endif

v8::PageAllocator* SetPlatformPageAllocatorForTesting(
    v8::PageAllocator* new_page_allocator) {}

void* Malloced::operator new(size_t size) {}

void Malloced::operator delete(void* p) {}

char* StrDup(const char* str) {}

char* StrNDup(const char* str, size_t n) {}

void* AllocWithRetry(size_t size, MallocFn malloc_fn) {}

base::AllocationResult<void*> AllocAtLeastWithRetry(size_t size) {}

void* AlignedAllocWithRetry(size_t size, size_t alignment) {}

void AlignedFree(void* ptr) {}

size_t AllocatePageSize() {}

size_t CommitPageSize() {}

void* GetRandomMmapAddr() {}

void* AllocatePages(v8::PageAllocator* page_allocator, void* hint, size_t size,
                    size_t alignment, PageAllocator::Permission access) {}

void FreePages(v8::PageAllocator* page_allocator, void* address,
               const size_t size) {}

void ReleasePages(v8::PageAllocator* page_allocator, void* address, size_t size,
                  size_t new_size) {}

bool SetPermissions(v8::PageAllocator* page_allocator, void* address,
                    size_t size, PageAllocator::Permission access) {}

void OnCriticalMemoryPressure() {}

VirtualMemory::VirtualMemory() = default;

VirtualMemory::VirtualMemory(v8::PageAllocator* page_allocator, size_t size,
                             void* hint, size_t alignment,
                             PageAllocator::Permission permissions)
    :{}

VirtualMemory::~VirtualMemory() {}

void VirtualMemory::Reset() {}

bool VirtualMemory::SetPermissions(Address address, size_t size,
                                   PageAllocator::Permission access) {}

bool VirtualMemory::RecommitPages(Address address, size_t size,
                                  PageAllocator::Permission access) {}

bool VirtualMemory::DiscardSystemPages(Address address, size_t size) {}

size_t VirtualMemory::Release(Address free_start) {}

void VirtualMemory::Free() {}

void VirtualMemory::FreeReadOnly() {}

VirtualMemoryCage::VirtualMemoryCage() = default;

VirtualMemoryCage::~VirtualMemoryCage() {}

VirtualMemoryCage::VirtualMemoryCage(VirtualMemoryCage&& other) V8_NOEXCEPT {}

VirtualMemoryCage& VirtualMemoryCage::operator=(VirtualMemoryCage&& other)
    V8_NOEXCEPT {}

bool VirtualMemoryCage::InitReservation(
    const ReservationParams& params, base::AddressRegion existing_reservation) {}

void VirtualMemoryCage::Free() {}

}  // namespace internal
}  // namespace v8