Index: runtime/bin/gen_snapshot.cc |
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc |
index 17acc09fcd58da6d6c0b6ad2c5f1da1933aa995e..5d971eff441093dc1d42738474d67860ae6aa9c1 100644 |
--- a/runtime/bin/gen_snapshot.cc |
+++ b/runtime/bin/gen_snapshot.cc |
@@ -1266,8 +1266,16 @@ int main(int argc, char** argv) { |
// Now we create an isolate into which we load all the code that needs to |
// be in the snapshot. |
isolate_data = new IsolateData(NULL, NULL, NULL); |
- if (Dart_CreateIsolate(NULL, NULL, NULL, NULL, isolate_data, &error) == |
- NULL) { |
+ intptr_t payload_bytes = 0; |
+ const uint8_t* payload = NULL; |
siva
2016/11/16 05:49:34
Maybe names like kernel_length and kernel would be
Vyacheslav Egorov (Google)
2016/11/16 12:47:46
Done.
|
+ const bool is_kernel_file = |
+ TryReadKernel(app_script_name, &payload, &payload_bytes); |
+ Dart_Isolate isolate = |
+ is_kernel_file |
+ ? Dart_CreateIsolateFromKernel(NULL, NULL, payload, payload_bytes, |
+ NULL, isolate_data, &error) |
+ : Dart_CreateIsolate(NULL, NULL, NULL, NULL, isolate_data, &error); |
+ if (isolate == NULL) { |
fprintf(stderr, "%s", error); |
free(error); |
exit(255); |
@@ -1284,11 +1292,6 @@ int main(int argc, char** argv) { |
Dart_QualifiedFunctionName* entry_points = |
ParseEntryPointsManifestIfPresent(); |
- intptr_t payload_bytes = 0; |
- const uint8_t* payload = NULL; |
- const bool is_kernel_file = |
- TryReadKernel(app_script_name, &payload, &payload_bytes); |
- |
if (is_kernel_file) { |
Dart_Handle library = Dart_LoadKernel(payload, payload_bytes); |
free(const_cast<uint8_t*>(payload)); |