5#ifndef RUNTIME_VM_ZONE_H_
6#define RUNTIME_VM_ZONE_H_
25 template <
class ElementType>
31 template <
class ElementType>
32 inline ElementType*
Realloc(ElementType* old_array,
80 while (other !=
nullptr) {
81 if (
this == other)
return true;
82 other = other->previous_;
94 static intptr_t
Size() {
return total_size_; }
101 static constexpr intptr_t kInitialChunkSize = 128;
104 static constexpr intptr_t kSegmentSize = 64 *
KB;
107 static constexpr unsigned char kZapDeletedByte = 0x42;
110 static constexpr unsigned char kZapUninitializedByte = 0xab;
119 uword AllocateLargeSegment(intptr_t
size);
122 void Link(
Zone* current_zone) { previous_ = current_zone; }
129 template <
class ElementType>
130 void Free(ElementType* old_array, intptr_t
len) {
133 ASSERT(old_array !=
nullptr);
134 memset(
static_cast<void*
>(old_array), kZapUninitializedByte,
135 len *
sizeof(ElementType));
141 template <
class ElementType>
142 static inline void CheckLength(intptr_t
len);
159 intptr_t small_segment_capacity_ = 0;
175 ALIGN8 uint8_t buffer_[kInitialChunkSize];
180 template <
typename T,
typename B,
typename Allocator>
182 template <
typename T,
typename B,
typename Allocator>
196#if defined(DART_USE_ABSL)
217#if defined(DART_USE_ABSL)
228 template <
typename T>
230 template <
typename T>
257 FATAL(
"Zone::Alloc: 'size' is too large: size=%" Pd "",
size);
263 intptr_t free_size = (limit_ - position_);
264 if (free_size >=
size) {
277template <
class ElementType>
278inline void Zone::CheckLength(intptr_t
len) {
279 const intptr_t kElementSize =
sizeof(ElementType);
281 FATAL(
"Zone::Alloc: 'len' is too large: len=%" Pd ", kElementSize=%" Pd,
286template <
class ElementType>
288 CheckLength<ElementType>(
len);
289 return reinterpret_cast<ElementType*
>(
AllocUnsafe(
len *
sizeof(ElementType)));
292template <
class ElementType>
296 CheckLength<ElementType>(new_len);
297 const intptr_t kElementSize =
sizeof(ElementType);
298 if (old_data !=
nullptr) {
300 reinterpret_cast<uword>(old_data) + (old_len * kElementSize);
304 reinterpret_cast<uword>(old_data) + (new_len * kElementSize);
306 if (new_end <= limit_) {
308 size_ +=
static_cast<intptr_t
>(new_len - old_len);
312 if (new_len <= old_len) {
316 ElementType* new_data = Alloc<ElementType>(new_len);
317 if (old_data !=
nullptr) {
318 memmove(
reinterpret_cast<void*
>(new_data),
319 reinterpret_cast<void*
>(old_data), old_len * kElementSize);
#define COMPILE_ASSERT(expr)
ThreadState * thread() const
StackZone(ThreadState *thread)
intptr_t CapacityInBytes() const
uintptr_t SizeInBytes() const
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)
char * PrintToString(const char *format,...) PRINTF_ATTRIBUTE(2
uword AllocUnsafe(intptr_t size)
ElementType * Realloc(ElementType *old_array, intptr_t old_len, intptr_t new_len)
bool ContainsNestedZone(Zone *other) const
ElementType * Alloc(intptr_t len)
uintptr_t CapacityInBytes() const
uintptr_t SizeInBytes() const
void Free(ElementType *old_array, intptr_t len)
char * MakeCopyOfStringN(const char *str, intptr_t len)
static constexpr intptr_t kAlignment
char * MakeCopyOfString(const char *str)
ElementType * Realloc(ElementType *old_array, intptr_t old_length, intptr_t new_length)
char * ConcatStrings(const char *a, const char *b, char join=',')
ElementType * Alloc(intptr_t length)
void VisitObjectPointers(ObjectPointerVisitor *visitor)
char char * VPrint(const char *format, va_list args)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
constexpr intptr_t kDoubleSize
constexpr intptr_t kIntptrMax
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
static SkString join(const CommandLineFlags::StringArray &)