6#if defined(DART_HOST_OS_WINDOWS)
16uword VirtualMemory::page_size_ = 0;
18intptr_t VirtualMemory::CalculatePageSize() {
21 const intptr_t page_size =
info.dwPageSize;
31 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
32 void*
address = VirtualAlloc(
nullptr,
size, MEM_RESERVE | MEM_COMMIT, prot);
40 if (address_ !=
nullptr) {
41 if (VirtualFree(address_, 0, MEM_RELEASE) == 0) {
60 prot = PAGE_READWRITE;
63 prot = PAGE_EXECUTE_READ;
66 prot = PAGE_EXECUTE_READWRITE;
70 if (VirtualProtect(
reinterpret_cast<void*
>(page_address),
71 end_address - page_address, prot, &old_prot) == 0) {
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr T RoundDown(T x, intptr_t alignment)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
static constexpr bool IsPowerOfTwo(T x)
static VirtualMemory * Allocate(intptr_t size, bool is_executable, const char *name)
static void Protect(void *address, intptr_t size, Protection mode)
static intptr_t PageSize()
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)