#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "v8_platform_page_allocator.h"
#include "base/check_op.h"
#include "base/cpu.h"
#include "base/memory/page_size.h"
#include "build/build_config.h"
#include "partition_alloc/address_space_randomization.h"
#include "partition_alloc/page_allocator_constants.h"
#include "partition_alloc/random.h"
namespace {
template <typename T>
T IfBtiEnabledOr(T enabled_value, T disabled_value) { … }
::partition_alloc::PageAccessibilityConfiguration::Permissions
GetPagePermissions(v8::PageAllocator::Permission permission) { … }
::partition_alloc::PageAccessibilityConfiguration GetPageConfig(
v8::PageAllocator::Permission permission) { … }
}
namespace gin {
PageAllocator::~PageAllocator() = default;
size_t PageAllocator::AllocatePageSize() { … }
size_t PageAllocator::CommitPageSize() { … }
void PageAllocator::SetRandomMmapSeed(int64_t seed) { … }
void* PageAllocator::GetRandomMmapAddr() { … }
void* PageAllocator::AllocatePages(void* address,
size_t length,
size_t alignment,
v8::PageAllocator::Permission permissions) { … }
bool PageAllocator::FreePages(void* address, size_t length) { … }
bool PageAllocator::ReleasePages(void* address,
size_t length,
size_t new_length) { … }
bool PageAllocator::SetPermissions(void* address,
size_t length,
Permission permissions) { … }
bool PageAllocator::RecommitPages(void* address,
size_t length,
Permission permissions) { … }
bool PageAllocator::DiscardSystemPages(void* address, size_t size) { … }
bool PageAllocator::DecommitPages(void* address, size_t size) { … }
partition_alloc::PageAccessibilityConfiguration::Permissions
PageAllocator::GetPageConfigPermissionsForTesting(
v8::PageAllocator::Permission permission) { … }
}