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

Unified Diff: runtime/bin/main.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/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 61d76f7a80bf32c58a635f0493746ab9ee7dc76b..948f112894e41e69405e4caf947c01b669d3d6fe 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -1487,7 +1487,6 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) {
if (gen_snapshot_kind == kAppAOT) {
Dart_QualifiedFunctionName standalone_entry_points[] = {
- {"dart:_builtin", "::", "_getMainClosure"},
{"dart:_builtin", "::", "_getPrintClosure"},
{"dart:_builtin", "::", "_getUriBaseClosure"},
{"dart:_builtin", "::", "_libraryFilePath"},
@@ -1571,13 +1570,16 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) {
CHECK_RESULT(result);
}
- // The helper function _getMainClosure creates a closure for the main
- // entry point which is either explicitly or implictly exported from the
- // root library.
+ // Create a closure for the main entry point which is in the exported
+ // namespace of the root library or invoke a getter of the same name
+ // in the exported namespace and return the resulting closure.
Dart_Handle main_closure =
- Dart_Invoke(isolate_data->builtin_lib(),
- Dart_NewStringFromCString("_getMainClosure"), 0, NULL);
+ Dart_GetClosure(root_lib, Dart_NewStringFromCString("main"));
CHECK_RESULT(main_closure);
+ if (!Dart_IsClosure(main_closure)) {
+ ErrorExit(kErrorExitCode,
+ "Unable to find 'main' in root library '%s'\n", script_name);
+ }
// Call _startIsolate in the isolate library to enable dispatching the
// initial startup message.

Powered by Google App Engine
This is Rietveld 408576698