Chromium Code Reviews| Index: runtime/bin/main.cc |
| diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc |
| index 10861340c162816ac3e1d4c67d8264fb2068cce5..2c6f70003a27ee30185bff14449e400053be3d79 100644 |
| --- a/runtime/bin/main.cc |
| +++ b/runtime/bin/main.cc |
| @@ -44,14 +44,12 @@ extern const uint8_t* isolate_snapshot_buffer; |
| /** |
| * Global state used to control and store generation of application snapshots |
| - * (script/full). |
| - * A full application snapshot can be generated and run using the following |
| - * commands |
| - * - Generating a full application snapshot : |
| - * dart_bootstrap --full-snapshot-after-run=<filename> --package-root=<dirs> |
| - * <script_uri> [<script_options>] |
| - * - Running the full application snapshot generated above : |
| - * dart --run-full-snapshot=<filename> <script_uri> [<script_options>] |
| + * An application snapshot can be generated and run using the following |
| + * command |
| + * dart --snapshot-kind=app-jit --snapshot=<app_snapshot_filename> |
| + * <script_uri> [<script_options>] |
| + * To Run the application snapshot generated above, use : |
| + * dart <app_snapshot_filename> [<script_options>] |
|
rmacnak
2016/10/18 23:55:46
We still need the no code option as a command line
siva
2016/10/19 22:16:52
Addressed by the change of generating an app snaps
|
| */ |
| static bool run_app_snapshot = false; |
| static const char* snapshot_filename = NULL; |
| @@ -59,8 +57,7 @@ enum SnapshotKind { |
| kNone, |
| kScript, |
| kAppAOT, |
| - kAppJITAfterRun, |
| - kAppAfterRun, |
| + kAppJIT, |
| }; |
| static SnapshotKind gen_snapshot_kind = kNone; |
| @@ -360,15 +357,12 @@ static bool ProcessSnapshotKindOption(const char* kind, |
| } else if (strcmp(kind, "app-aot") == 0) { |
| gen_snapshot_kind = kAppAOT; |
| return true; |
| - } else if (strcmp(kind, "app-jit-after-run") == 0) { |
| - gen_snapshot_kind = kAppJITAfterRun; |
| - return true; |
| - } else if (strcmp(kind, "app-after-run") == 0) { |
| - gen_snapshot_kind = kAppAfterRun; |
| + } else if (strcmp(kind, "app-jit") == 0) { |
| + gen_snapshot_kind = kAppJIT; |
| return true; |
| } |
| Log::PrintErr("Unrecognized snapshot kind: '%s'\nValid kinds are: " |
| - "script, app-aot, app-jit-after-run, app-after-run\n", kind); |
| + "script, app-aot, app-jit\n", kind); |
| return false; |
| } |
| @@ -1152,27 +1146,16 @@ static bool FileModifiedCallback(const char* url, int64_t since) { |
| } |
| -static void WriteSnapshotFile(const char* snapshot_directory, |
| - const char* filename, |
| +static void WriteSnapshotFile(const char* filename, |
| bool write_magic_number, |
| const uint8_t* buffer, |
| const intptr_t size) { |
| char* concat = NULL; |
| - const char* qualified_filename; |
| - if ((snapshot_directory != NULL) && (strlen(snapshot_directory) > 0)) { |
| - intptr_t len = snprintf(NULL, 0, "%s/%s", snapshot_directory, filename); |
| - concat = new char[len + 1]; |
| - snprintf(concat, len + 1, "%s/%s", snapshot_directory, filename); |
| - qualified_filename = concat; |
| - } else { |
| - qualified_filename = filename; |
| - } |
| - |
| - File* file = File::Open(qualified_filename, File::kWriteTruncate); |
| + File* file = File::Open(filename, File::kWriteTruncate); |
| if (file == NULL) { |
| ErrorExit(kErrorExitCode, |
| "Unable to open file %s for writing snapshot\n", |
| - qualified_filename); |
| + filename); |
| } |
| if (write_magic_number) { |
| @@ -1183,7 +1166,7 @@ static void WriteSnapshotFile(const char* snapshot_directory, |
| if (!file->WriteFully(buffer, size)) { |
| ErrorExit(kErrorExitCode, |
| "Unable to write file %s for writing snapshot\n", |
| - qualified_filename); |
| + filename); |
| } |
| file->Release(); |
| if (concat != NULL) { |
| @@ -1397,7 +1380,7 @@ static void GenerateScriptSnapshot() { |
| ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| } |
| - WriteSnapshotFile(NULL, snapshot_filename, true, buffer, size); |
| + WriteSnapshotFile(snapshot_filename, true, buffer, size); |
| } |
| @@ -1442,7 +1425,7 @@ static void GeneratePrecompiledSnapshot() { |
| rodata_blob_buffer, |
| rodata_blob_size); |
| } else { |
| - WriteSnapshotFile(NULL, snapshot_filename, |
| + WriteSnapshotFile(snapshot_filename, |
| false, |
| assembly_buffer, |
| assembly_size); |
| @@ -1483,31 +1466,6 @@ static void GeneratePrecompiledJITSnapshot() { |
| } |
| -static void GenerateFullSnapshot() { |
| - // Create a full snapshot of the script. |
| - Dart_Handle result; |
| - uint8_t* vm_isolate_buffer = NULL; |
| - intptr_t vm_isolate_size = 0; |
| - uint8_t* isolate_buffer = NULL; |
| - intptr_t isolate_size = 0; |
| - |
| - result = Dart_CreateSnapshot(&vm_isolate_buffer, |
| - &vm_isolate_size, |
| - &isolate_buffer, |
| - &isolate_size); |
| - if (Dart_IsError(result)) { |
| - ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result)); |
| - } |
| - |
| - WriteAppSnapshot(snapshot_filename, |
| - vm_isolate_buffer, |
| - vm_isolate_size, |
| - isolate_buffer, |
| - isolate_size, |
| - NULL, 0, NULL, 0); |
| -} |
| - |
| - |
| #define CHECK_RESULT(result) \ |
| if (Dart_IsError(result)) { \ |
| if (Dart_IsVMRestartRequest(result)) { \ |
| @@ -1574,9 +1532,8 @@ bool RunMainIsolate(const char* script_name, |
| result = Dart_LibraryImportLibrary( |
| isolate_data->builtin_lib(), root_lib, Dart_Null()); |
| if (is_noopt || |
| - (gen_snapshot_kind == kAppAfterRun) || |
| (gen_snapshot_kind == kAppAOT) || |
| - (gen_snapshot_kind == kAppJITAfterRun)) { |
| + (gen_snapshot_kind == kAppJIT)) { |
| // Load the embedder's portion of the VM service's Dart code so it will |
| // be included in the app snapshot. |
| if (!VmService::LoadForGenPrecompiled()) { |
| @@ -1678,17 +1635,12 @@ bool RunMainIsolate(const char* script_name, |
| // Keep handling messages until the last active receive port is closed. |
| result = Dart_RunLoop(); |
| // Generate an app snapshot after execution if specified. |
| - if ((gen_snapshot_kind == kAppAfterRun) || |
| - (gen_snapshot_kind == kAppJITAfterRun)) { |
| + if ((gen_snapshot_kind == kAppJIT)) { |
| if (!Dart_IsCompilationError(result) && |
|
rmacnak
2016/10/19 17:41:21
To get us going, perhaps
#if defined(TARGET_ARCH_
siva
2016/10/19 22:16:52
Done.
|
| !Dart_IsVMRestartRequest(result)) { |
| - if (gen_snapshot_kind == kAppAfterRun) { |
| - GenerateFullSnapshot(); |
| - } else { |
| - Dart_Handle prepare_result = Dart_PrecompileJIT(); |
| - CHECK_RESULT(prepare_result); |
| - GeneratePrecompiledJITSnapshot(); |
| - } |
| + Dart_Handle prepare_result = Dart_PrecompileJIT(); |
| + CHECK_RESULT(prepare_result); |
| + GeneratePrecompiledJITSnapshot(); |
| } |
| } |
| CHECK_RESULT(result); |
| @@ -1866,7 +1818,7 @@ void main(int argc, char** argv) { |
| } |
| #endif |
| - if (gen_snapshot_kind == kAppJITAfterRun) { |
| + if (gen_snapshot_kind == kAppJIT) { |
| vm_options.AddArgument("--fields_may_be_reset"); |
| } |
| if ((gen_snapshot_kind == kAppAOT) || is_noopt) { |