6#if defined(DART_HOST_OS_WINDOWS)
19uword VirtualMemory::page_size_ = 0;
20VirtualMemory* VirtualMemory::compressed_heap_ =
nullptr;
22intptr_t VirtualMemory::CalculatePageSize() {
25 const intptr_t page_size =
info.dwPageSize;
31static void* AllocateAlignedImpl(intptr_t
size,
33 intptr_t reserved_size,
35 void** out_reserved_address) {
36 void* address = VirtualAlloc(
nullptr, reserved_size, MEM_RESERVE, prot);
37 if (address ==
nullptr) {
41 void* aligned_address =
reinterpret_cast<void*
>(
43 if (VirtualAlloc(aligned_address,
size, MEM_COMMIT, prot) !=
45 VirtualFree(address, reserved_size, MEM_RELEASE);
49 if (out_reserved_address !=
nullptr) {
50 *out_reserved_address = address;
52 return aligned_address;
56 if (FLAG_old_gen_heap_size < 0 || FLAG_old_gen_heap_size >
kMaxAddrSpaceMB) {
58 "warning: value specified for --old_gen_heap_size %d is larger than"
59 " the physically addressable range, using 0(unlimited) instead.`\n",
60 FLAG_old_gen_heap_size);
61 FLAG_old_gen_heap_size = 0;
63 if (FLAG_new_gen_semi_max_size < 0 ||
66 "warning: value specified for --new_gen_semi_max_size %d is larger"
67 " than the physically addressable range, using %" Pd " instead.`\n",
71 page_size_ = CalculatePageSize();
72#if defined(DART_COMPRESSED_POINTERS)
73 ASSERT(compressed_heap_ ==
nullptr);
74 compressed_heap_ = Reserve(kCompressedHeapSize, kCompressedHeapAlignment);
75 if (compressed_heap_ ==
nullptr) {
77 FATAL(
"Failed to reserve region for compressed heap: %d",
error);
80 compressed_heap_->
size());
85#if defined(DART_COMPRESSED_POINTERS)
86 delete compressed_heap_;
89#if defined(DART_COMPRESSED_POINTERS)
90 compressed_heap_ =
nullptr;
107#if defined(DART_COMPRESSED_POINTERS)
112 if (
region.pointer() ==
nullptr) {
121 int prot = (is_executable && !FLAG_write_protect_code)
122 ? PAGE_EXECUTE_READWRITE
125 void* reserved_address;
126 void* aligned_address = AllocateAlignedImpl(
size, alignment, reserved_size,
127 prot, &reserved_address);
128 if (aligned_address ==
nullptr) {
133 MemoryRegion reserved(reserved_address, reserved_size);
134 return new VirtualMemory(
region, reserved);
137VirtualMemory* VirtualMemory::Reserve(intptr_t
size, intptr_t alignment) {
142 void* reserved_address =
143 VirtualAlloc(
nullptr, reserved_size, MEM_RESERVE, PAGE_NOACCESS);
144 if (reserved_address ==
nullptr) {
148 void* aligned_address =
reinterpret_cast<void*
>(
151 MemoryRegion reserved(reserved_address, reserved_size);
152 return new VirtualMemory(
region, reserved);
155void VirtualMemory::Commit(
void* address, intptr_t
size) {
165void VirtualMemory::Decommit(
void* address, intptr_t
size) {
180#if defined(DART_COMPRESSED_POINTERS)
182 (
this != compressed_heap_)) {
191 if (VirtualFree(reserved_.
pointer(), 0, MEM_RELEASE) == 0) {
196bool VirtualMemory::FreeSubSegment(
void* address, intptr_t
size) {
197#if defined(DART_COMPRESSED_POINTERS)
203 if (VirtualFree(
address,
size, MEM_DECOMMIT) == 0) {
212 ASSERT(thread ==
nullptr || thread->IsDartMutatorThread() ||
213 thread->isolate() ==
nullptr ||
214 thread->isolate()->mutator_thread()->IsAtSafepoint());
217 uword end_address = start_address +
size;
222 prot = PAGE_NOACCESS;
225 prot = PAGE_READONLY;
228 prot = PAGE_READWRITE;
231 prot = PAGE_EXECUTE_READ;
234 prot = PAGE_EXECUTE_READWRITE;
238 if (VirtualProtect(
reinterpret_cast<void*
>(page_address),
239 end_address - page_address, prot, &old_prot) == 0) {
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define RELEASE_ASSERT(cond)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static Thread * Current()
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
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 * AllocateAligned(intptr_t size, intptr_t alignment, bool is_executable, bool is_compressed, const char *name)
static void Protect(void *address, intptr_t size, Protection mode)
static intptr_t PageSize()
bool vm_owns_region() const
static void DontNeed(void *address, intptr_t size)
const uint8_t uint32_t uint32_t GError ** error
ClipOpAndAA opAA SkRegion region
bool Contains(const Container &container, const Value &value)
static void * Allocate(uword size, Zone *zone)
const intptr_t kDefaultNewGenSemiMaxSize
static void Free(FreeList *free_list, uword address, intptr_t size, bool is_protected)
const intptr_t kMaxAddrSpaceMB
DECLARE_FLAG(bool, show_invisible_frames)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)