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

Unified Diff: runtime/bin/gen_snapshot.cc

Issue 2927493002: Restructure code to enable reloading when a kernel dill file is specified on the command line inste… (Closed)
Patch Set: fix format error. 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
« no previous file with comments | « runtime/bin/dfe.cc ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/gen_snapshot.cc
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 5d4811c92dfe11e14e166a09d62263e6c5d57698..b5e34bf6b0131db1c4212f3dc74af15eb277ff27 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -1658,28 +1658,20 @@ int main(int argc, char** argv) {
// be in the snapshot.
isolate_data = new IsolateData(app_script_name, commandline_package_root,
commandline_packages_file, NULL);
- const uint8_t* kernel = NULL;
- intptr_t kernel_length = 0;
- const bool is_kernel_file =
- dfe.TryReadKernelFile(app_script_name, &kernel, &kernel_length);
-
if ((dependencies_filename != NULL) || print_dependencies) {
isolate_data->set_dependencies(new MallocGrowableArray<char*>());
}
- void* kernel_program = NULL;
- if (is_kernel_file) {
- kernel_program = Dart_ReadKernelBinary(kernel, kernel_length);
- free(const_cast<uint8_t*>(kernel));
+ Dart_Isolate isolate = NULL;
+ void* kernel_program = dfe.ReadScript(app_script_name);
+ if (kernel_program != NULL) {
+ isolate = Dart_CreateIsolateFromKernel(NULL, NULL, kernel_program, NULL,
+ isolate_data, &error);
+ } else {
+ isolate = Dart_CreateIsolate(NULL, NULL, isolate_snapshot_data,
+ isolate_snapshot_instructions, NULL,
+ isolate_data, &error);
}
-
- Dart_Isolate isolate =
- is_kernel_file
- ? Dart_CreateIsolateFromKernel(NULL, NULL, kernel_program, NULL,
- isolate_data, &error)
- : Dart_CreateIsolate(NULL, NULL, isolate_snapshot_data,
- isolate_snapshot_instructions, NULL,
- isolate_data, &error);
if (isolate == NULL) {
Log::PrintErr("%s\n", error);
free(error);
@@ -1701,7 +1693,7 @@ int main(int argc, char** argv) {
Dart_QualifiedFunctionName* entry_points =
ParseEntryPointsManifestIfPresent();
- if (is_kernel_file) {
+ if (kernel_program != NULL) {
Dart_Handle library = Dart_LoadKernel(kernel_program);
if (Dart_IsError(library)) FATAL("Failed to load app from Kernel IR");
} else {
@@ -1715,7 +1707,7 @@ int main(int argc, char** argv) {
SetupStubNativeResolvers();
- if (!is_kernel_file) {
+ if (kernel_program == NULL) {
// Load the specified script.
library = LoadSnapshotCreationScript(app_script_name);
CHECK_RESULT(library);
« no previous file with comments | « runtime/bin/dfe.cc ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698