5#ifndef RUNTIME_VM_HEAP_HEAP_H_
6#define RUNTIME_VM_HEAP_HEAP_H_
8#if defined(SHOULD_NOT_INCLUDE_RUNTIME)
9#error "Should not include runtime"
29class ObjectPointerVisitor;
32class TimelineEventScope;
45#if !defined(HASH_IN_OBJECT_HEADER)
51#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
71 return AllocateOld(thread,
size,
false);
73 return AllocateNew(thread,
size);
75 return AllocateOld(thread,
size,
false);
77 return AllocateOld(thread,
size,
true);
114 bool compact =
false);
134 intptr_t max_new_gen_words,
135 intptr_t max_old_gen_words);
138 bool Verify(
const char* msg,
172#if !defined(HASH_IN_OBJECT_HEADER)
212#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
227 return new_weak_tables_[selector];
230 return old_weak_tables_[selector];
234 new_weak_tables_[selector] =
value;
237 old_weak_tables_[selector] =
value;
244#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
301 DISALLOW_COPY_AND_ASSIGN(
Data);
313 intptr_t max_new_gen_semi_words,
314 intptr_t max_old_gen_words);
331 bool VerifyGC(
const char* msg,
342 void PrintStatsToTimeline(TimelineEventScope*
event,
GCReason reason);
347 void CollectForDebugging(
Thread* thread);
367 bool assume_scavenge_will_fail_;
369 static constexpr intptr_t kNoForcedGarbageCollection = -1;
374 intptr_t gc_on_nth_allocation_;
452 static void CollectNewSpace() {
463 static void CollectOldSpace() {
466 if (thread->is_marking()) {
481 static void WaitForGCTasks() {
484 thread->heap()->WaitForMarkerTasks(thread);
485 thread->heap()->WaitForSweeperTasks(thread);
static uint32_t hash(const SkShaderBase::GradientInfo &v)
ForceGrowthScope(Thread *thread)
void IterateObjectPointers(ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
void IterateStackPointers(ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
void IterateVMIsolateObjects(ObjectVisitor *visitor) const
void IterateObjects(ObjectVisitor *visitor) const
void IterateOldObjectsNoImagePages(ObjectVisitor *visitor) const
void IterateObjectsNoImagePages(ObjectVisitor *visitor) const
void IterateOldObjects(ObjectVisitor *visitor) const
HeapIterationScope(Thread *thread, bool writable=false)
void SetupImagePage(void *pointer, uword size, bool is_executable)
void SetLoadingUnit(ObjectPtr raw_obj, intptr_t unit_id)
static const char * GCReasonToString(GCReason reason)
bool AllocatedExternal(intptr_t size, Space space)
uword Allocate(Thread *thread, intptr_t size, Space space)
void CheckExternalGC(Thread *thread)
intptr_t GetWeakEntry(ObjectPtr raw_obj, WeakSelector sel) const
void PrintMemoryUsageJSON(JSONStream *stream) const
IsolateGroup * isolate_group() const
void CheckConcurrentMarking(Thread *thread, GCReason reason, intptr_t size)
intptr_t GetLoadingUnit(ObjectPtr raw_obj) const
bool OldContains(uword addr) const
Dart_PerformanceMode SetMode(Dart_PerformanceMode mode)
void SetHeapSamplingData(ObjectPtr obj, void *data)
intptr_t SetHashIfNotSet(ObjectPtr raw_obj, intptr_t hash)
void * GetPeer(ObjectPtr raw_obj) const
static constexpr uint8_t kZapByte
void ReportSurvivingAllocations(Dart_HeapSamplingReportCallback callback, void *context)
void WriteProtect(bool read_only)
bool NewContains(uword addr) const
void WaitForMarkerTasks(Thread *thread)
Dart_PerformanceMode mode() const
void WaitForSweeperTasksAtSafepoint(Thread *thread)
int64_t PeerCount() const
bool DataContains(uword addr) const
void SetWeakEntry(ObjectPtr raw_obj, WeakSelector sel, intptr_t val)
void ResetObjectIdTable()
void PrintToJSONObject(Space space, JSONObject *object) const
intptr_t GetHash(ObjectPtr raw_obj) const
void CheckCatchUp(Thread *thread)
bool Verify(const char *msg, MarkExpectation mark_expectation=kForbidMarked)
void SetPeer(ObjectPtr raw_obj, void *peer)
void CollectOnNthAllocation(intptr_t num_allocations)
bool is_vm_isolate() const
void WriteProtectCode(bool read_only)
intptr_t SetWeakEntryIfNonExistent(ObjectPtr raw_obj, WeakSelector sel, intptr_t val)
intptr_t TotalExternalInWords() const
void PrintHeapMapToJSONStream(IsolateGroup *isolate_group, JSONStream *stream)
void SetCanonicalHash(ObjectPtr raw_obj, intptr_t hash)
intptr_t ReachabilityBarrier()
void CollectAllGarbage(GCReason reason=GCReason::kFull, bool compact=false)
int64_t GCTimeInMicros(Space space) const
void NotifyIdle(int64_t deadline)
void WaitForSweeperTasks(Thread *thread)
void CheckFinalizeMarking(Thread *thread)
intptr_t Collections(Space space) const
WeakTable * GetWeakTable(Space space, WeakSelector selector) const
bool Contains(uword addr) const
void ForwardWeakEntries(ObjectPtr before_object, ObjectPtr after_object)
void ResetCanonicalHashTable()
intptr_t ExternalInWords(Space space) const
void StartConcurrentMarking(Thread *thread, GCReason reason)
bool CodeContains(uword addr) const
void PromotedExternal(intptr_t size)
friend class GCTestHelper
void SetWeakTable(Space space, WeakSelector selector, WeakTable *value)
intptr_t TotalCapacityInWords() const
intptr_t UsedInWords(Space space) const
static void Init(IsolateGroup *isolate_group, bool is_vm_isolate, intptr_t max_new_gen_words, intptr_t max_old_gen_words)
intptr_t TotalUsedInWords() const
intptr_t GetCanonicalHash(ObjectPtr raw_obj) const
void CollectGarbage(Thread *thread, GCType type, GCReason reason)
void ForwardWeakTables(ObjectPointerVisitor *visitor)
intptr_t GetObjectId(ObjectPtr raw_obj) const
void UpdateGlobalMaxUsed()
Space SpaceForExternal(intptr_t size) const
void SetObjectId(ObjectPtr raw_obj, intptr_t object_id)
intptr_t CapacityInWords(Space space) const
ObjectSet * CreateAllocatedObjectSet(Zone *zone, MarkExpectation mark_expectation)
void FreedExternal(intptr_t size, Space space)
static const char * GCTypeToString(GCType type)
void WriteProtectCode(bool read_only)
void PrintHeapMapToJSONStream(IsolateGroup *isolate_group, JSONStream *stream) const
intptr_t collections() const
void SetupImagePage(void *pointer, uword size, bool is_executable)
ThreadState * thread() const
static Thread * Current()
ExecutionState execution_state() const
void ReportSurvivingAllocations(Dart_HeapSamplingReportCallback callback, void *context)
WritableCodePages(Thread *thread, IsolateGroup *isolate_group)
WritableVMIsolateScope(Thread *thread)
~WritableVMIsolateScope()
@ Dart_PerformanceMode_Default
void(* Dart_HeapSamplingReportCallback)(void *context, void *data)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
bool IsAllocatableInNewSpace(intptr_t size)
static void CollectAllGarbage(Thread *thread, JSONStream *js)
static int8_t data[kExtLength]
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
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set