Minor code reorg to ensure we don't include parts of the Library tag handler in the precompiled runtime builds.
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2896523003 .
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index c939e70..cdf370b 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -617,7 +617,22 @@
payload_length);
}
+#if defined(DART_PRECOMPILED_RUNTIME)
+Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag,
+ Dart_Handle library,
+ Dart_Handle url) {
+ return Dart_Null();
+}
+
+Dart_Handle Loader::DartColonLibraryTagHandler(Dart_LibraryTag tag,
+ Dart_Handle library,
+ Dart_Handle url,
+ const char* library_url_string,
+ const char* url_string) {
+ return Dart_Null();
+}
+#else
Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag,
Dart_Handle library,
Dart_Handle url) {
@@ -803,6 +818,7 @@
UNREACHABLE();
return Dart_Null();
}
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
void Loader::InitOnce() {
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index b58f9b2..412a2fb2 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -114,7 +114,6 @@
static char* app_script_uri = NULL;
static const uint8_t* app_isolate_snapshot_data = NULL;
static const uint8_t* app_isolate_snapshot_instructions = NULL;
-static AppSnapshot* app_snapshot = NULL;
static Dart_Isolate main_isolate = NULL;
@@ -837,13 +836,16 @@
}
}
+ void* kernel_platform = NULL;
+ void* kernel_program = NULL;
+ AppSnapshot* app_snapshot = NULL;
+
#if defined(DART_PRECOMPILED_RUNTIME)
// AOT: All isolates start from the app snapshot.
bool isolate_run_app_snapshot = true;
const uint8_t* isolate_snapshot_data = app_isolate_snapshot_data;
const uint8_t* isolate_snapshot_instructions =
app_isolate_snapshot_instructions;
- AppSnapshot* app_snapshot = NULL;
#else
// JIT: Main isolate starts from the app snapshot, if any. Other isolates
// use the core libraries snapshot.
@@ -851,7 +853,6 @@
const uint8_t* isolate_snapshot_data = core_isolate_snapshot_data;
const uint8_t* isolate_snapshot_instructions =
core_isolate_snapshot_instructions;
- AppSnapshot* app_snapshot = NULL;
if ((app_isolate_snapshot_data != NULL) &&
(is_main_isolate || ((app_script_uri != NULL) &&
(strcmp(script_uri, app_script_uri) == 0)))) {
@@ -869,11 +870,6 @@
&isolate_snapshot_data, &isolate_snapshot_instructions);
}
}
-#endif
-
- void* kernel_platform = NULL;
- void* kernel_program = NULL;
-#if !defined(DART_PRECOMPILED_RUNTIME)
const bool is_service_isolate =
strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0;
if (!is_kernel_isolate && !is_service_isolate) {
@@ -1658,7 +1654,7 @@
Platform::Exit(kErrorExitCode);
}
- app_snapshot = Snapshot::TryReadAppSnapshot(script_name);
+ AppSnapshot* app_snapshot = Snapshot::TryReadAppSnapshot(script_name);
if (app_snapshot != NULL) {
vm_run_app_snapshot = true;
app_snapshot->SetBuffers(&vm_snapshot_data, &vm_snapshot_instructions,