Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
dart::Zone::Segment Class Reference

Public Member Functions

Segmentnext () const
 
intptr_t size () const
 
VirtualMemorymemory () const
 
uword start ()
 
uword end ()
 

Static Public Member Functions

static SegmentNew (intptr_t size, Segment *next)
 
static void DeleteSegmentList (Segment *segment)
 

Detailed Description

Definition at line 24 of file zone.cc.

Member Function Documentation

◆ DeleteSegmentList()

void dart::Zone::Segment::DeleteSegmentList ( Segment segment)
static

Definition at line 114 of file zone.cc.

114 {
115 Segment* current = head;
116 while (current != nullptr) {
117 intptr_t size = current->size();
118 Segment* next = current->next();
119 VirtualMemory* memory = current->memory();
120#ifdef DEBUG
121 // Zap the entire current segment (including the header).
122 ASAN_UNPOISON(reinterpret_cast<void*>(current), current->size());
123 memset(reinterpret_cast<void*>(current), kZapDeletedByte, current->size());
124#endif
125 LSAN_UNREGISTER_ROOT_REGION(current, sizeof(*current));
126
127 if (size == kSegmentSize) {
128 MutexLocker ml(segment_cache_mutex);
133 memory = nullptr;
134 }
135 }
136 if (memory != nullptr) {
137 total_size_.fetch_sub(size);
138 delete memory;
139 }
140 current = next;
141 }
142}
#define ASAN_UNPOISON(ptr, len)
intptr_t size() const
Definition zone.cc:27
Segment * next() const
Definition zone.cc:26
VirtualMemory * memory() const
Definition zone.cc:28
#define ASSERT(E)
#define LSAN_UNREGISTER_ROOT_REGION(ptr, len)
static intptr_t segment_cache_size
Definition zone.cc:56
static VirtualMemory * segment_cache[kSegmentCacheCapacity]
Definition zone.cc:55
static constexpr intptr_t kSegmentCacheCapacity
Definition zone.cc:53
static Mutex * segment_cache_mutex
Definition zone.cc:54

◆ end()

uword dart::Zone::Segment::end ( )
inline

Definition at line 31 of file zone.cc.

31{ return address(size_); }

◆ memory()

VirtualMemory * dart::Zone::Segment::memory ( ) const
inline

Definition at line 28 of file zone.cc.

28{ return memory_; }

◆ New()

Zone::Segment * dart::Zone::Segment::New ( intptr_t  size,
Zone::Segment next 
)
static

Definition at line 78 of file zone.cc.

78 {
80 VirtualMemory* memory = nullptr;
81 if (size == kSegmentSize) {
82 MutexLocker ml(segment_cache_mutex);
85 if (segment_cache_size > 0) {
87 }
88 }
89 if (memory == nullptr) {
90 bool executable = false;
91 bool compressed = false;
92 memory = VirtualMemory::Allocate(size, executable, compressed, "dart-zone");
93 total_size_.fetch_add(size);
94 }
95 if (memory == nullptr) {
97 }
98 Segment* result = reinterpret_cast<Segment*>(memory->start());
99#ifdef DEBUG
100 // Zap the entire allocated segment (including the header).
101 ASAN_UNPOISON(reinterpret_cast<void*>(result), size);
102 memset(reinterpret_cast<void*>(result), kZapUninitializedByte, size);
103#endif
104 result->next_ = next;
105 result->size_ = size;
106 result->memory_ = memory;
107 result->alignment_ = nullptr; // Avoid unused variable warnings.
108
110
111 return result;
112}
#define OUT_OF_MEMORY()
Definition assert.h:250
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition utils.h:105
static intptr_t PageSize()
static VirtualMemory * Allocate(intptr_t size, bool is_executable, bool is_compressed, const char *name)
uword start() const
GAsyncResult * result
#define LSAN_REGISTER_ROOT_REGION(ptr, len)

◆ next()

Segment * dart::Zone::Segment::next ( ) const
inline

Definition at line 26 of file zone.cc.

26{ return next_; }

◆ size()

intptr_t dart::Zone::Segment::size ( ) const
inline

Definition at line 27 of file zone.cc.

27{ return size_; }

◆ start()

uword dart::Zone::Segment::start ( )
inline

Definition at line 30 of file zone.cc.

30{ return address(sizeof(Segment)); }

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