![]() |
v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
|
#include <lsan-page-allocator.h>
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< SharedMemory > | AllocateSharedPages (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 |
![]() | |
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 | |
![]() | |
enum | Permission { kNoAccess , kRead , kReadWrite , kReadWriteExecute , kReadExecute , kNoAccessWillJitLater } |
Definition at line 23 of file lsan-page-allocator.h.
|
explicit |
Definition at line 17 of file lsan-page-allocator.cc.
|
overridedefault |
|
overridevirtual |
Allocates memory in range with the given alignment and permission.
Implements v8::PageAllocator.
Definition at line 24 of file lsan-page-allocator.cc.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
inlineoverridevirtual |
Sets permissions on pages in an allocated range.
Implements v8::PageAllocator.
Definition at line 52 of file lsan-page-allocator.h.
|
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.
|
private |
Definition at line 72 of file lsan-page-allocator.h.
|
private |
Definition at line 73 of file lsan-page-allocator.h.
|
private |
Definition at line 71 of file lsan-page-allocator.h.