v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::base::LsanPageAllocator Class Reference

#include <lsan-page-allocator.h>

Inheritance diagram for v8::base::LsanPageAllocator:
Collaboration diagram for v8::base::LsanPageAllocator:

Public Member Functions

 LsanPageAllocator (v8::PageAllocator *page_allocator)
 
 ~LsanPageAllocator () override=default
 
size_t AllocatePageSize () override
 
size_t CommitPageSize () override
 
void SetRandomMmapSeed (int64_t seed) override
 
void * GetRandomMmapAddr () override
 
void * AllocatePages (void *address, size_t size, size_t alignment, PageAllocator::Permission access) override
 
std::unique_ptr< SharedMemoryAllocateSharedPages (size_t size, const void *original_address) override
 
bool CanAllocateSharedPages () override
 
bool FreePages (void *address, size_t size) override
 
bool ReleasePages (void *address, size_t size, size_t new_size) override
 
bool SetPermissions (void *address, size_t size, PageAllocator::Permission access) override
 
bool RecommitPages (void *address, size_t size, PageAllocator::Permission access) override
 
bool DiscardSystemPages (void *address, size_t size) override
 
bool DecommitPages (void *address, size_t size) override
 
- Public Member Functions inherited from v8::PageAllocator
virtual ~PageAllocator ()=default
 
virtual bool SealPages (void *address, size_t length)
 
virtual bool ReserveForSharedMemoryMapping (void *address, size_t size)
 

Private Attributes

v8::PageAllocator *const page_allocator_
 
const size_t allocate_page_size_
 
const size_t commit_page_size_
 

Additional Inherited Members

- Public Types inherited from v8::PageAllocator
enum  Permission {
  kNoAccess , kRead , kReadWrite , kReadWriteExecute ,
  kReadExecute , kNoAccessWillJitLater
}
 

Detailed Description

Definition at line 23 of file lsan-page-allocator.h.

Constructor & Destructor Documentation

◆ LsanPageAllocator()

v8::base::LsanPageAllocator::LsanPageAllocator ( v8::PageAllocator * page_allocator)
explicit

Definition at line 17 of file lsan-page-allocator.cc.

◆ ~LsanPageAllocator()

v8::base::LsanPageAllocator::~LsanPageAllocator ( )
overridedefault

Member Function Documentation

◆ AllocatePages()

void * v8::base::LsanPageAllocator::AllocatePages ( void * address,
size_t length,
size_t alignment,
PageAllocator::Permission permissions )
overridevirtual

Allocates memory in range with the given alignment and permission.

Implements v8::PageAllocator.

Definition at line 24 of file lsan-page-allocator.cc.

Here is the call graph for this function:

◆ AllocatePageSize()

size_t v8::base::LsanPageAllocator::AllocatePageSize ( )
inlineoverridevirtual

Gets the page granularity for AllocatePages and FreePages. Addresses and lengths for those calls should be multiples of AllocatePageSize().

Implements v8::PageAllocator.

Definition at line 28 of file lsan-page-allocator.h.

◆ AllocateSharedPages()

std::unique_ptr< v8::PageAllocator::SharedMemory > v8::base::LsanPageAllocator::AllocateSharedPages ( size_t length,
const void * original_address )
overridevirtual

INTERNAL ONLY: This interface has not been stabilised and may change without notice from one release to another without being deprecated first.

Allocates shared memory pages. Not all PageAllocators need support this and so this method need not be overridden. Allocates a new read-only shared memory region of size |length| and copies the memory at |original_address| into it.

Reimplemented from v8::PageAllocator.

Definition at line 47 of file lsan-page-allocator.cc.

Here is the call graph for this function:

◆ CanAllocateSharedPages()

bool v8::base::LsanPageAllocator::CanAllocateSharedPages ( )
overridevirtual

INTERNAL ONLY: This interface has not been stabilised and may change without notice from one release to another without being deprecated first.

If not overridden and changed to return true, V8 will not attempt to call AllocateSharedPages or RemapSharedPages. If overridden, AllocateSharedPages and RemapSharedPages must also be overridden.

Reimplemented from v8::PageAllocator.

Definition at line 58 of file lsan-page-allocator.cc.

Here is the call graph for this function:

◆ CommitPageSize()

size_t v8::base::LsanPageAllocator::CommitPageSize ( )
inlineoverridevirtual

Gets the page granularity for SetPermissions and ReleasePages. Addresses and lengths for those calls should be multiples of CommitPageSize().

Implements v8::PageAllocator.

Definition at line 30 of file lsan-page-allocator.h.

◆ DecommitPages()

bool v8::base::LsanPageAllocator::DecommitPages ( void * address,
size_t size )
inlineoverridevirtual

Decommits any wired memory pages in the given range, allowing the OS to reclaim them, and marks the region as inacessible (kNoAccess). The address range stays reserved and can be accessed again later by changing its permissions. However, in that case the memory content is guaranteed to be zero-initialized again. The memory must have been previously allocated by a call to AllocatePages. Returns true on success, false otherwise.

Implements v8::PageAllocator.

Definition at line 66 of file lsan-page-allocator.h.

Here is the call graph for this function:

◆ DiscardSystemPages()

bool v8::base::LsanPageAllocator::DiscardSystemPages ( void * address,
size_t size )
inlineoverridevirtual

Frees memory in the given [address, address + size) range. address and size should be operating system page-aligned. The next write to this memory area brings the memory transparently back. This should be treated as a hint to the OS that the pages are no longer needed. It does not guarantee that the pages will be discarded immediately or at all.

Reimplemented from v8::PageAllocator.

Definition at line 62 of file lsan-page-allocator.h.

Here is the call graph for this function:

◆ FreePages()

bool v8::base::LsanPageAllocator::FreePages ( void * address,
size_t length )
overridevirtual

Frees memory in a range that was allocated by a call to AllocatePages.

Implements v8::PageAllocator.

Definition at line 62 of file lsan-page-allocator.cc.

Here is the call graph for this function:

◆ GetRandomMmapAddr()

void * v8::base::LsanPageAllocator::GetRandomMmapAddr ( )
inlineoverridevirtual

Returns a randomized address, suitable for memory allocation under ASLR. The address will be aligned to AllocatePageSize.

Implements v8::PageAllocator.

Definition at line 36 of file lsan-page-allocator.h.

Here is the call graph for this function:

◆ RecommitPages()

bool v8::base::LsanPageAllocator::RecommitPages ( void * address,
size_t length,
PageAllocator::Permission permissions )
inlineoverridevirtual

Recommits discarded pages in the given range with given permissions. Discarded pages must be recommitted with their original permissions before they are used again.

Reimplemented from v8::PageAllocator.

Definition at line 57 of file lsan-page-allocator.h.

Here is the call graph for this function:

◆ ReleasePages()

bool v8::base::LsanPageAllocator::ReleasePages ( void * address,
size_t length,
size_t new_length )
overridevirtual

Releases memory in a range that was allocated by a call to AllocatePages.

Implements v8::PageAllocator.

Definition at line 75 of file lsan-page-allocator.cc.

Here is the call graph for this function:

◆ SetPermissions()

bool v8::base::LsanPageAllocator::SetPermissions ( void * address,
size_t length,
PageAllocator::Permission permissions )
inlineoverridevirtual

Sets permissions on pages in an allocated range.

Implements v8::PageAllocator.

Definition at line 52 of file lsan-page-allocator.h.

Here is the call graph for this function:

◆ SetRandomMmapSeed()

void v8::base::LsanPageAllocator::SetRandomMmapSeed ( int64_t seed)
inlineoverridevirtual

Sets the random seed so that GetRandomMmapAddr() will generate repeatable sequences of random mmap addresses.

Implements v8::PageAllocator.

Definition at line 32 of file lsan-page-allocator.h.

Here is the call graph for this function:

Member Data Documentation

◆ allocate_page_size_

const size_t v8::base::LsanPageAllocator::allocate_page_size_
private

Definition at line 72 of file lsan-page-allocator.h.

◆ commit_page_size_

const size_t v8::base::LsanPageAllocator::commit_page_size_
private

Definition at line 73 of file lsan-page-allocator.h.

◆ page_allocator_

v8::PageAllocator* const v8::base::LsanPageAllocator::page_allocator_
private

Definition at line 71 of file lsan-page-allocator.h.


The documentation for this class was generated from the following files: