Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1621)

Unified Diff: runtime/vm/object.cc

Issue 2933603002: 1. Dynamic compute the main closure that needs to be run by the main isolate (Closed)
Patch Set: Address review comments. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index db19ab39c99ae3623a34b8d0ea12fb4bc7aa0b99..728e2ffe6446a8833d056194b9aef8d727408440 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12063,6 +12063,32 @@ RawFunction* Library::GetFunction(const GrowableArray<Library*>& libs,
}
+RawObject* Library::GetFunctionClosure(const String& name) const {
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ Function& func = Function::Handle(zone, LookupFunctionAllowPrivate(name));
+ if (func.IsNull()) {
+ // Check whether the function is reexported into the library.
+ const Object& obj = Object::Handle(zone, LookupReExport(name));
+ if (obj.IsFunction()) {
+ func ^= obj.raw();
+ } else {
+ // Check if there is a getter of 'name', in which case invoke it
+ // and return the result.
+ const String& getter_name = String::Handle(zone, Field::GetterName(name));
+ func = LookupFunctionAllowPrivate(getter_name);
+ if (func.IsNull()) {
+ return Closure::null();
+ }
+ // Invoke the getter and return the result.
+ return DartEntry::InvokeFunction(func, Object::empty_array());
+ }
+ }
+ func = func.ImplicitClosureFunction();
+ return func.ImplicitStaticClosure();
+}
+
+
#if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT)
void Library::CheckFunctionFingerprints() {
GrowableArray<Library*> all_libs;
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.h » ('j') | tests/co19/co19-kernel.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698