5#ifndef V8_UTILS_ALLOCATION_H_
6#define V8_UTILS_ALLOCATION_H_
20class BoundedPageAllocator;
34 static void*
operator new(
size_t size);
35 static void operator delete(
void* p);
44 T*
result =
new (std::nothrow) T[size];
47 result =
new (std::nothrow) T[size];
85 template <
typename T,
typename TypeTag = T[]>
87 return static_cast<T*
>(Malloced::operator
new(length *
sizeof(
T)));
89 template <
typename T,
typename TypeTag = T[]>
91 Malloced::operator
delete(p);
115#ifdef V8_ENABLE_SANDBOX
126#ifdef V8_ENABLE_SANDBOX
127 return GetSandboxPageAllocator();
156 void* address,
size_t size,
180 void* address,
size_t size,
184 return SetPermissions(page_allocator,
reinterpret_cast<void*
>(address), size,
207 size_t alignment = 1,
virtual size_t AllocatePageSize()=0
virtual size_t CommitPageSize()=0
bool contains(Address address) const
V8_INLINE void DeleteArray(T *p, size_t length)
V8_INLINE T * AllocateArray(size_t length)
static V8_EXPORT_PRIVATE void FatalProcessOutOfMemory(Isolate *isolate, const char *location, const OOMDetails &details=kNoOOMDetails)
base::BoundedPageAllocator * page_allocator() const
base::AddressRegion region() const
const VirtualMemory * reservation() const
VirtualMemoryCage(const VirtualMemoryCage &)=delete
virtual ~VirtualMemoryCage()
VirtualMemory reservation_
bool InitReservation(const ReservationParams ¶ms, base::AddressRegion existing_reservation=base::AddressRegion())
std::unique_ptr< base::BoundedPageAllocator > page_allocator_
VirtualMemory * reservation()
VirtualMemoryCage & operator=(VirtualMemoryCage &)=delete
v8::PageAllocator * page_allocator_
V8_EXPORT_PRIVATE ~VirtualMemory()
VirtualMemory(VirtualMemory &&other) V8_NOEXCEPT
V8_EXPORT_PRIVATE bool DiscardSystemPages(Address address, size_t size)
V8_EXPORT_PRIVATE VirtualMemory()
bool InVM(Address address, size_t size) const
VirtualMemory(v8::PageAllocator *page_allocator, Address address, size_t size)
v8::PageAllocator * page_allocator()
base::AddressRegion region_
VirtualMemory(const VirtualMemory &)=delete
VirtualMemory & operator=(VirtualMemory &&other) V8_NOEXCEPT
VirtualMemory & operator=(const VirtualMemory &)=delete
V8_EXPORT_PRIVATE void Free()
V8_EXPORT_PRIVATE void Reset()
V8_EXPORT_PRIVATE size_t Release(Address free_start)
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT bool SetPermissions(Address address, size_t size, PageAllocator::Permission access)
const base::AddressRegion & region() const
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT bool RecommitPages(Address address, size_t size, PageAllocator::Permission access)
ZoneVector< RpoNumber > & result
void * Malloc(size_t size)
void DeleteArray(T *array)
bool SetPermissions(v8::PageAllocator *page_allocator, void *address, size_t size, PageAllocator::Permission access)
v8::PageAllocator * GetPlatformPageAllocator()
void * AllocatePages(v8::PageAllocator *page_allocator, void *hint, size_t size, size_t alignment, PageAllocator::Permission access)
v8::PageAllocator * SetPlatformPageAllocatorForTesting(v8::PageAllocator *new_page_allocator)
void * AlignedAllocWithRetry(size_t size, size_t alignment)
void OnCriticalMemoryPressure()
void * GetRandomMmapAddr()
std::unique_ptr< T, ArrayDeleter< T > > ArrayUniquePtr
v8::PageAllocator * GetArrayBufferPageAllocator()
char * StrDup(const char *str)
void *(*)(size_t) MallocFn
v8::VirtualAddressSpace * GetPlatformVirtualAddressSpace()
size_t AllocatePageSize()
void * AllocWithRetry(size_t size, MallocFn malloc_fn)
void AlignedFree(void *ptr)
base::AllocationResult< void * > AllocAtLeastWithRetry(size_t size)
char * StrNDup(const char *str, size_t n)
static constexpr Address kNullAddress
void ReleasePages(v8::PageAllocator *page_allocator, void *address, size_t size, size_t new_size)
T * NewArray(size_t size)
void FreePages(v8::PageAllocator *page_allocator, void *address, const size_t size)
#define DCHECK_NOT_NULL(val)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define V8_EXPORT_PRIVATE
constexpr bool IsAligned(T value, U alignment)
void operator()(T *array)
base::PageInitializationMode page_initialization_mode
PageAllocator::Permission permissions
base::PageFreeingMode page_freeing_mode
static constexpr size_t kAnyBaseAlignment
v8::PageAllocator * page_allocator
Address requested_start_hint
#define V8_WARN_UNUSED_RESULT
#define V8_UNLIKELY(condition)