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

Unified Diff: runtime/vm/kernel_reader.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/kernel_reader.cc
diff --git a/runtime/vm/kernel_reader.cc b/runtime/vm/kernel_reader.cc
index bbc8e1ae8d9e17ccea786597f1a64c049212f3a9..f2923d5623bcea97b86d82bf68734d46bad99900 100644
--- a/runtime/vm/kernel_reader.cc
+++ b/runtime/vm/kernel_reader.cc
@@ -176,32 +176,18 @@ Object& KernelReader::ReadProgram() {
}
if (ClassFinalizer::ProcessPendingClasses(/*from_kernel=*/true)) {
- // There is a function _getMainClosure in dart:_builtin that returns the
- // main procedure. Since the platform libraries are compiled before the
- // program script, this function might need to be patched here.
-
- // If there is no main method then we have compiled a partial Kernel file
- // and do not need to patch here.
+ // If 'main' is not found return a null library, this is the case
+ // when bootstrapping is in progress.
NameIndex main = program_->main_method();
if (main == -1) {
return dart::Library::Handle(Z);
}
- // If the builtin library is not set in the object store, then we are
- // bootstrapping and do not need to patch here.
- dart::Library& builtin_library =
- dart::Library::Handle(Z, I->object_store()->builtin_library());
- if (builtin_library.IsNull()) {
- return dart::Library::Handle(Z);
- }
-
NameIndex main_library = H.EnclosingName(main);
dart::Library& library = LookupLibrary(main_library);
// Sanity check that we can find the main entrypoint.
- Object& main_obj = Object::Handle(
- Z, library.LookupObjectAllowPrivate(H.DartSymbol("main")));
- ASSERT(!main_obj.IsNull());
-
+ ASSERT(library.LookupObjectAllowPrivate(H.DartSymbol("main")) !=
+ Object::null());
return library;
}
}
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.h » ('j') | tests/co19/co19-kernel.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698