Chromium Code Reviews| Index: runtime/bin/main.cc |
| diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc |
| index 35ad358150d58ab340e59bc89e0df2916cacf63e..084a29b1949ea30d35b55be546c512091e6ca6a2 100644 |
| --- a/runtime/bin/main.cc |
| +++ b/runtime/bin/main.cc |
| @@ -23,6 +23,7 @@ |
| #include "bin/log.h" |
| #include "bin/platform.h" |
| #include "bin/process.h" |
| +#include "bin/service_isolate_bindata.h" |
| #include "bin/snapshot_utils.h" |
| #include "bin/thread.h" |
| #include "bin/utils.h" |
| @@ -45,6 +46,9 @@ extern const uint8_t kDartCoreIsolateSnapshotInstructions[]; |
| } |
| namespace dart { |
| + |
| +DECLARE_FLAG(bool, use_dart_frontend); |
|
siva
2017/06/08 01:05:18
This is not needed you can use dfe.UseDartFrontEnd
|
| + |
| namespace bin { |
| // Snapshot pieces if we link in a snapshot, otherwise initialized to NULL. |
| @@ -996,23 +1000,37 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri, |
| #if defined(DART_PRECOMPILED_RUNTIME) |
| // AOT: All isolates start from the app snapshot. |
| - bool isolate_run_app_snapshot = true; |
| + bool skip_library_load = true; |
| const uint8_t* isolate_snapshot_data = app_isolate_snapshot_data; |
| const uint8_t* isolate_snapshot_instructions = |
| app_isolate_snapshot_instructions; |
| #else |
| // JIT: Service isolate uses the core libraries snapshot. |
| - bool isolate_run_app_snapshot = false; |
| + bool skip_library_load = false; |
| const uint8_t* isolate_snapshot_data = core_isolate_snapshot_data; |
| const uint8_t* isolate_snapshot_instructions = |
| core_isolate_snapshot_instructions; |
| #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| + Dart_Isolate isolate = NULL; |
| IsolateData* isolate_data = |
| new IsolateData(script_uri, package_root, packages_config, NULL); |
| - Dart_Isolate isolate = Dart_CreateIsolate( |
| - script_uri, main, isolate_snapshot_data, isolate_snapshot_instructions, |
| - flags, isolate_data, error); |
| + if (FLAG_use_dart_frontend) { |
| + ASSERT(service_isolate_kernel_bindata_size_ != 0); |
| + void* kernel = Dart_ReadKernelBinary(service_isolate_kernel_bindata_, |
| + service_isolate_kernel_bindata_size_); |
| + if (kernel == NULL) { |
| + *error = strdup("Could not load service isolate from kernel"); |
| + } else { |
| + isolate = Dart_CreateIsolateFromKernel(script_uri, NULL, kernel, flags, |
| + isolate_data, error); |
| + skip_library_load = true; |
| + } |
| + } else { |
| + isolate = Dart_CreateIsolate(script_uri, main, isolate_snapshot_data, |
| + isolate_snapshot_instructions, flags, |
| + isolate_data, error); |
| + } |
| if (isolate == NULL) { |
| delete isolate_data; |
| return NULL; |
| @@ -1024,7 +1042,6 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri, |
| CHECK_RESULT(result); |
| // Load embedder specific bits and return. |
| - bool skip_library_load = isolate_run_app_snapshot; |
| if (!VmService::Setup(vm_service_server_ip, vm_service_server_port, |
| skip_library_load, vm_service_dev_mode, |
| trace_loading)) { |