13intptr_t WeakTable::SizeFor(intptr_t
count, intptr_t
size) {
23 "Reached impossible state of having more weak table entries"
24 " than memory available for heap objects.");
34 const intptr_t mask =
size() - 1;
35 intptr_t idx = Hash(
key) & mask;
36 intptr_t empty_idx = -1;
39 while (obj !=
static_cast<ObjectPtr>(kNoEntry)) {
43 }
else if ((empty_idx < 0) &&
44 (
static_cast<intptr_t
>(obj) == kDeletedEntry)) {
47 idx = (idx + 1) & mask;
66 SetObjectAt(idx,
key);
70 set_count(
count() + 1);
73 if (used_ >= limit()) {
79 const intptr_t mask =
size() - 1;
80 intptr_t idx = Hash(
key) & mask;
81 intptr_t empty_idx = -1;
84 while (obj !=
static_cast<ObjectPtr>(kNoEntry)) {
87 }
else if ((empty_idx < 0) &&
88 (
static_cast<intptr_t
>(obj) == kDeletedEntry)) {
91 idx = (idx + 1) & mask;
105 SetObjectAt(idx,
key);
106 SetValueAt(idx, val);
108 set_used(
used() + 1);
109 set_count(
count() + 1);
112 if (used_ >= limit()) {
119 intptr_t* old_data = data_;
124 data_ =
reinterpret_cast<intptr_t*
>(
malloc(size_ * kEntrySize *
kWordSize));
125 for (intptr_t
i = 0;
i < size_;
i++) {
126 data_[ObjectIndex(
i)] = kNoEntry;
132 if (used_ == 0)
return;
134 for (intptr_t
i = 0;
i < size_;
i++) {
143#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
148 for (intptr_t
i = 0;
i < size_;
i++) {
150 void*
data =
reinterpret_cast<void*
>(data_[ValueIndex(
i)]);
157 for (intptr_t
i = 0;
i < size_;
i++) {
159 cleanup(
reinterpret_cast<void*
>(data_[ValueIndex(
i)]));
165void WeakTable::Rehash() {
166 intptr_t old_size =
size();
167 intptr_t* old_data = data_;
169 intptr_t new_size = SizeFor(
count(),
size());
172 reinterpret_cast<intptr_t*
>(
malloc(new_size * kEntrySize *
kWordSize));
173 for (intptr_t
i = 0;
i < new_size;
i++) {
174 new_data[ObjectIndex(
i)] = kNoEntry;
178 intptr_t mask = new_size - 1;
180 for (intptr_t
i = 0;
i < old_size;
i++) {
184 intptr_t idx = Hash(
key) & mask;
185 ObjectPtr obj =
static_cast<ObjectPtr
>(new_data[ObjectIndex(idx)]);
186 while (obj !=
static_cast<ObjectPtr
>(kNoEntry)) {
188 idx = (idx + 1) & mask;
189 obj =
static_cast<ObjectPtr
>(new_data[ObjectIndex(idx)]);
192 new_data[ObjectIndex(idx)] =
static_cast<intptr_t
>(
key);
194 set_used(
used() + 1);
void VisitPointer(ObjectPtr *p)
static constexpr bool IsPowerOfTwo(T x)
static constexpr intptr_t kNoValue
bool MarkValueExclusive(ObjectPtr key, intptr_t val)
intptr_t ValueAtExclusive(intptr_t i) const
void SetValueExclusive(ObjectPtr key, intptr_t val)
bool IsValidEntryAtExclusive(intptr_t i) const
void ReportSurvivingAllocations(Dart_HeapSamplingReportCallback callback, void *context)
ObjectPtr ObjectAtExclusive(intptr_t i) const
void Forward(ObjectPointerVisitor *visitor)
void CleanupValues(Dart_HeapSamplingDeleteCallback cleanup)
void(* Dart_HeapSamplingDeleteCallback)(void *data)
void(* Dart_HeapSamplingReportCallback)(void *context, void *data)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
void * malloc(size_t size)
constexpr intptr_t kWordSize
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