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

#include <program_visitor.h>

Inheritance diagram for dart::ProgramVisitor:
dart::AllStatic

Static Public Member Functions

static void WalkProgram (Zone *zone, IsolateGroup *isolate_group, ClassVisitor *visitor)
 
static void Dedup (Thread *thread)
 

Detailed Description

Definition at line 94 of file program_visitor.h.

Member Function Documentation

◆ Dedup()

void dart::ProgramVisitor::Dedup ( Thread thread)
static

Definition at line 1409 of file program_visitor.cc.

1409 {
1410 BindStaticCalls(thread);
1411 ShareMegamorphicBuckets(thread);
1412 NormalizeAndDedupCompressedStackMaps(thread);
1413 DedupPcDescriptors(thread);
1414 DedupDeoptEntries(thread);
1415#if defined(DART_PRECOMPILER)
1416 DedupCatchEntryMovesMaps(thread);
1417 DedupUnlinkedCalls(thread);
1418 PruneSubclasses(thread);
1419#endif
1420 DedupCodeSourceMaps(thread);
1421 DedupLists(thread);
1422
1423 // Reduces binary size but obfuscates profiler results.
1424 if (FLAG_dedup_instructions) {
1425 DedupInstructions(thread);
1426 }
1427}

◆ WalkProgram()

void dart::ProgramVisitor::WalkProgram ( Zone zone,
IsolateGroup isolate_group,
ClassVisitor visitor 
)
static

Definition at line 215 of file program_visitor.cc.

217 {
218 auto const object_store = isolate_group->object_store();
219 auto const heap = isolate_group->heap();
220 ProgramWalker walker(zone, heap, visitor);
221
222 // Walk through the libraries looking for visitable objects.
223 const auto& libraries =
224 GrowableObjectArray::Handle(zone, object_store->libraries());
225 auto& lib = Library::Handle(zone);
226 auto& cls = Class::Handle(zone);
227
228 for (intptr_t i = 0; i < libraries.Length(); i++) {
229 lib ^= libraries.At(i);
230 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
231 while (it.HasNext()) {
232 cls = it.GetNextClass();
233 walker.AddToWorklist(cls);
234 }
235 }
236
237 // If there's a global object pool, add any visitable objects.
238 const auto& global_object_pool =
239 ObjectPool::Handle(zone, object_store->global_object_pool());
240 if (!global_object_pool.IsNull()) {
241 auto& object = Object::Handle(zone);
242 for (intptr_t i = 0; i < global_object_pool.Length(); i++) {
243 auto const type = global_object_pool.TypeAt(i);
244 if (type != ObjectPool::EntryType::kTaggedObject) continue;
245 object = global_object_pool.ObjectAt(i);
246 walker.AddToWorklist(object);
247 }
248 }
249
250 if (visitor->IsFunctionVisitor()) {
251 // Function objects not necessarily reachable from classes.
252 ClosureFunctionsCache::ForAllClosureFunctions([&](const Function& fun) {
253 walker.AddToWorklist(fun);
254 ASSERT(!fun.HasImplicitClosureFunction());
255 return true; // Continue iteration.
256 });
257
258 // TODO(dartbug.com/43049): Use a more general solution and remove manual
259 // tracking through object_store->ffi_callback_functions.
260 if (object_store->ffi_callback_functions() != Array::null()) {
261 auto& function = Function::Handle(zone);
262 FfiCallbackFunctionSet set(object_store->ffi_callback_functions());
263 FfiCallbackFunctionSet::Iterator it(&set);
264 while (it.MoveNext()) {
265 const intptr_t entry = it.Current();
266 function ^= set.GetKey(entry);
267 walker.AddToWorklist(function);
268 }
269 set.Release();
270 }
271 }
272
273 if (visitor->IsCodeVisitor()) {
274 // Code objects not necessarily reachable from functions.
275 auto& code = Code::Handle(zone);
276 const auto& dispatch_table_entries =
277 Array::Handle(zone, object_store->dispatch_table_code_entries());
278 if (!dispatch_table_entries.IsNull()) {
279 for (intptr_t i = 0; i < dispatch_table_entries.Length(); i++) {
280 code ^= dispatch_table_entries.At(i);
281 walker.AddToWorklist(code);
282 }
283 }
284 }
285
286 // Walk the program starting from any roots we added to the worklist.
287 walker.VisitWorklist();
288}
static void ForAllClosureFunctions(std::function< bool(const Function &)> callback)
static ObjectPtr null()
Definition object.h:433
static Object & Handle()
Definition object.h:407
#define ASSERT(E)
Dart_NativeFunction function
Definition fuchsia.cc:51
UnorderedHashSet< CanonicalFfiCallbackFunctionTraits > FfiCallbackFunctionSet
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
Definition switches.h:76

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