10#if defined(DART_COMPRESSED_HEAP)
14uword VirtualMemoryCompressedHeap::base_ = 0;
15uword VirtualMemoryCompressedHeap::size_ = 0;
16uint8_t* VirtualMemoryCompressedHeap::pages_ =
nullptr;
17uword VirtualMemoryCompressedHeap::minimum_free_page_id_ = 0;
18Mutex* VirtualMemoryCompressedHeap::mutex_ =
nullptr;
20uint8_t PageMask(
uword page_id) {
21 return static_cast<uint8_t
>(1 << (page_id % 8));
24bool VirtualMemoryCompressedHeap::IsPageUsed(
uword page_id) {
25 if (page_id >= kCompressedHeapNumPages)
return false;
26 return pages_[page_id / 8] & PageMask(page_id);
29void VirtualMemoryCompressedHeap::SetPageUsed(
uword page_id) {
30 ASSERT(page_id < kCompressedHeapNumPages);
31 pages_[page_id / 8] |= PageMask(page_id);
34void VirtualMemoryCompressedHeap::ClearPageUsed(
uword page_id) {
35 ASSERT(page_id < kCompressedHeapNumPages);
36 pages_[page_id / 8] &= ~PageMask(page_id);
41 pages_ =
new uint8_t[kCompressedHeapBitmapSize];
42 memset(pages_, 0, kCompressedHeapBitmapSize);
45 for (intptr_t page_id =
size / kCompressedPageSize;
46 page_id < kCompressedHeapNumPages; page_id++) {
49 base_ =
reinterpret_cast<uword>(compressed_heap_region);
53 ASSERT(size_ <= kCompressedHeapSize);
60 intptr_t mask = ~(kCompressedHeapAlignment - 1);
61 ASSERT((base_ & mask) == ((base_ + size_ - 1) & mask));
71 minimum_free_page_id_ = 0;
75void* VirtualMemoryCompressedHeap::GetRegion() {
76 return reinterpret_cast<void*
>(base_);
81 ASSERT(alignment <= kCompressedHeapAlignment);
83 uword pages = allocated_size / kCompressedPageSize;
84 uword page_alignment =
85 alignment > kCompressedPageSize ? alignment / kCompressedPageSize : 1;
86 MutexLocker ml(mutex_);
91 for (
uword gap = 0;;) {
92 if (IsPageUsed(page_id)) {
104 ASSERT(page_id % page_alignment == 0);
108 if (end > kCompressedHeapSize / kCompressedPageSize) {
109 return MemoryRegion();
119 while (IsPageUsed(minimum_free_page_id_)) {
120 ++minimum_free_page_id_;
123 uword address = base_ + page_id * kCompressedPageSize;
125 return MemoryRegion(
reinterpret_cast<void*
>(address), allocated_size);
132 MutexLocker ml(mutex_);
134 uword page_id = (
start - base_) / kCompressedPageSize;
139 if (page_id < minimum_free_page_id_) {
140 minimum_free_page_id_ = page_id;
145 return (
reinterpret_cast<uword>(address) - base_) < size_;
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
bool Contains(const Container &container, const Value &value)
static void * Allocate(uword size, Zone *zone)
static void Free(FreeList *free_list, uword address, intptr_t size, bool is_protected)
NOT_IN_PRODUCT(LibraryPtr ReloadTestScript(const char *script))
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