Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Generate a snapshot file after loading all the scripts specified on the | 5 // Generate a snapshot file after loading all the scripts specified on the |
| 6 // command line. | 6 // command line. |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 | 61 |
| 62 // The core snapshot to use when creating isolates. Normally NULL, but loaded | 62 // The core snapshot to use when creating isolates. Normally NULL, but loaded |
| 63 // from a file when creating script snapshots. | 63 // from a file when creating script snapshots. |
| 64 const uint8_t* isolate_snapshot_data = NULL; | 64 const uint8_t* isolate_snapshot_data = NULL; |
| 65 | 65 |
| 66 | 66 |
| 67 // Global state that indicates whether a snapshot is to be created and | 67 // Global state that indicates whether a snapshot is to be created and |
| 68 // if so which file to write the snapshot into. | 68 // if so which file to write the snapshot into. |
| 69 enum SnapshotKind { | 69 enum SnapshotKind { |
| 70 kNone, | |
| 71 kCore, | 70 kCore, |
| 72 kScript, | 71 kScript, |
| 73 kAppAOTBlobs, | 72 kAppAOTBlobs, |
| 74 kAppAOTAssembly, | 73 kAppAOTAssembly, |
| 75 }; | 74 }; |
| 76 static SnapshotKind snapshot_kind = kCore; | 75 static SnapshotKind snapshot_kind = kCore; |
| 77 static const char* vm_snapshot_data_filename = NULL; | 76 static const char* vm_snapshot_data_filename = NULL; |
| 78 static const char* vm_snapshot_instructions_filename = NULL; | 77 static const char* vm_snapshot_instructions_filename = NULL; |
| 79 static const char* isolate_snapshot_data_filename = NULL; | 78 static const char* isolate_snapshot_data_filename = NULL; |
| 80 static const char* isolate_snapshot_instructions_filename = NULL; | 79 static const char* isolate_snapshot_instructions_filename = NULL; |
| 81 static const char* assembly_filename = NULL; | 80 static const char* assembly_filename = NULL; |
| 82 static const char* script_snapshot_filename = NULL; | 81 static const char* script_snapshot_filename = NULL; |
| 82 static bool dependencies_only = false; | |
| 83 static const char* dependencies_filename = NULL; | 83 static const char* dependencies_filename = NULL; |
| 84 | 84 |
| 85 | 85 |
| 86 // Value of the --package-root flag. | 86 // Value of the --package-root flag. |
| 87 // (This pointer points into an argv buffer and does not need to be | 87 // (This pointer points into an argv buffer and does not need to be |
| 88 // free'd.) | 88 // free'd.) |
| 89 static const char* commandline_package_root = NULL; | 89 static const char* commandline_package_root = NULL; |
| 90 | 90 |
| 91 // Value of the --packages flag. | 91 // Value of the --packages flag. |
| 92 // (This pointer points into an argv buffer and does not need to be | 92 // (This pointer points into an argv buffer and does not need to be |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 if (strncmp(option, name, length) == 0) { | 201 if (strncmp(option, name, length) == 0) { |
| 202 return (option + length); | 202 return (option + length); |
| 203 } | 203 } |
| 204 return NULL; | 204 return NULL; |
| 205 } | 205 } |
| 206 | 206 |
| 207 | 207 |
| 208 static bool ProcessSnapshotKindOption(const char* option) { | 208 static bool ProcessSnapshotKindOption(const char* option) { |
| 209 const char* kind = ProcessOption(option, "--snapshot_kind="); | 209 const char* kind = ProcessOption(option, "--snapshot_kind="); |
| 210 if (kind == NULL) { | 210 if (kind == NULL) { |
| 211 kind = ProcessOption(option, "--snapshot-kind="); | |
| 212 } | |
|
siva
2017/02/27 22:03:37
With these changes of accepting '-' and '_' gen_sn
rmacnak
2017/02/27 23:18:00
Agreed
| |
| 213 if (kind == NULL) { | |
| 211 return false; | 214 return false; |
| 212 } | 215 } |
| 213 if (strcmp(kind, "none") == 0) { | 216 if (strcmp(kind, "core") == 0) { |
| 214 snapshot_kind = kNone; | |
| 215 return true; | |
| 216 } else if (strcmp(kind, "core") == 0) { | |
| 217 snapshot_kind = kCore; | 217 snapshot_kind = kCore; |
| 218 return true; | 218 return true; |
| 219 } else if (strcmp(kind, "script") == 0) { | 219 } else if (strcmp(kind, "script") == 0) { |
| 220 snapshot_kind = kScript; | 220 snapshot_kind = kScript; |
| 221 return true; | 221 return true; |
| 222 } else if (strcmp(kind, "app-aot-blobs") == 0) { | 222 } else if (strcmp(kind, "app-aot-blobs") == 0) { |
| 223 snapshot_kind = kAppAOTBlobs; | 223 snapshot_kind = kAppAOTBlobs; |
| 224 return true; | 224 return true; |
| 225 } else if (strcmp(kind, "app-aot-assembly") == 0) { | 225 } else if (strcmp(kind, "app-aot-assembly") == 0) { |
| 226 snapshot_kind = kAppAOTAssembly; | 226 snapshot_kind = kAppAOTAssembly; |
| 227 return true; | 227 return true; |
| 228 } | 228 } |
| 229 Log::PrintErr( | 229 Log::PrintErr( |
| 230 "Unrecognized snapshot kind: '%s'\nValid kinds are: " | 230 "Unrecognized snapshot kind: '%s'\nValid kinds are: " |
| 231 "core, script, app-aot-blobs, app-aot-assembly\n", | 231 "core, script, app-aot-blobs, app-aot-assembly\n", |
| 232 kind); | 232 kind); |
| 233 return false; | 233 return false; |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 static bool ProcessVmSnapshotDataOption(const char* option) { | 237 static bool ProcessVmSnapshotDataOption(const char* option) { |
| 238 const char* name = ProcessOption(option, "--vm_snapshot_data="); | 238 const char* name = ProcessOption(option, "--vm_snapshot_data="); |
| 239 if (name == NULL) { | |
| 240 name = ProcessOption(option, "--vm-snapshot-data="); | |
| 241 } | |
| 239 if (name != NULL) { | 242 if (name != NULL) { |
| 240 vm_snapshot_data_filename = name; | 243 vm_snapshot_data_filename = name; |
| 241 return true; | 244 return true; |
| 242 } | 245 } |
| 243 return false; | 246 return false; |
| 244 } | 247 } |
| 245 | 248 |
| 246 | 249 |
| 247 static bool ProcessVmSnapshotInstructionsOption(const char* option) { | 250 static bool ProcessVmSnapshotInstructionsOption(const char* option) { |
| 248 const char* name = ProcessOption(option, "--vm_snapshot_instructions="); | 251 const char* name = ProcessOption(option, "--vm_snapshot_instructions="); |
| 252 if (name == NULL) { | |
| 253 name = ProcessOption(option, "--vm-snapshot-instructions="); | |
| 254 } | |
| 249 if (name != NULL) { | 255 if (name != NULL) { |
| 250 vm_snapshot_instructions_filename = name; | 256 vm_snapshot_instructions_filename = name; |
| 251 return true; | 257 return true; |
| 252 } | 258 } |
| 253 return false; | 259 return false; |
| 254 } | 260 } |
| 255 | 261 |
| 256 | 262 |
| 257 static bool ProcessIsolateSnapshotDataOption(const char* option) { | 263 static bool ProcessIsolateSnapshotDataOption(const char* option) { |
| 258 const char* name = ProcessOption(option, "--isolate_snapshot_data="); | 264 const char* name = ProcessOption(option, "--isolate_snapshot_data="); |
| 265 if (name == NULL) { | |
| 266 name = ProcessOption(option, "--isolate-snapshot-data="); | |
| 267 } | |
| 259 if (name != NULL) { | 268 if (name != NULL) { |
| 260 isolate_snapshot_data_filename = name; | 269 isolate_snapshot_data_filename = name; |
| 261 return true; | 270 return true; |
| 262 } | 271 } |
| 263 return false; | 272 return false; |
| 264 } | 273 } |
| 265 | 274 |
| 266 | 275 |
| 267 static bool ProcessIsolateSnapshotInstructionsOption(const char* option) { | 276 static bool ProcessIsolateSnapshotInstructionsOption(const char* option) { |
| 268 const char* name = ProcessOption(option, "--isolate_snapshot_instructions="); | 277 const char* name = ProcessOption(option, "--isolate_snapshot_instructions="); |
| 278 if (name == NULL) { | |
| 279 name = ProcessOption(option, "--isolate-snapshot-instructions="); | |
| 280 } | |
| 269 if (name != NULL) { | 281 if (name != NULL) { |
| 270 isolate_snapshot_instructions_filename = name; | 282 isolate_snapshot_instructions_filename = name; |
| 271 return true; | 283 return true; |
| 272 } | 284 } |
| 273 return false; | 285 return false; |
| 274 } | 286 } |
| 275 | 287 |
| 276 | 288 |
| 277 static bool ProcessAssemblyOption(const char* option) { | 289 static bool ProcessAssemblyOption(const char* option) { |
| 278 const char* name = ProcessOption(option, "--assembly="); | 290 const char* name = ProcessOption(option, "--assembly="); |
| 279 if (name != NULL) { | 291 if (name != NULL) { |
| 280 assembly_filename = name; | 292 assembly_filename = name; |
| 281 return true; | 293 return true; |
| 282 } | 294 } |
| 283 return false; | 295 return false; |
| 284 } | 296 } |
| 285 | 297 |
| 286 | 298 |
| 287 static bool ProcessScriptSnapshotOption(const char* option) { | 299 static bool ProcessScriptSnapshotOption(const char* option) { |
| 288 const char* name = ProcessOption(option, "--script_snapshot="); | 300 const char* name = ProcessOption(option, "--script_snapshot="); |
| 301 if (name == NULL) { | |
| 302 name = ProcessOption(option, "--script-snapshot="); | |
| 303 } | |
| 289 if (name != NULL) { | 304 if (name != NULL) { |
| 290 script_snapshot_filename = name; | 305 script_snapshot_filename = name; |
| 291 return true; | 306 return true; |
| 292 } | 307 } |
| 293 return false; | 308 return false; |
| 294 } | 309 } |
| 295 | 310 |
| 296 | 311 |
| 297 static bool ProcessDependenciesOption(const char* option) { | 312 static bool ProcessDependenciesOption(const char* option) { |
| 298 const char* name = ProcessOption(option, "--dependencies="); | 313 const char* name = ProcessOption(option, "--dependencies="); |
| 299 if (name != NULL) { | 314 if (name != NULL) { |
| 300 dependencies_filename = name; | 315 dependencies_filename = name; |
| 301 return true; | 316 return true; |
| 302 } | 317 } |
| 303 return false; | 318 return false; |
| 304 } | 319 } |
| 305 | 320 |
| 306 | 321 |
| 322 static bool ProcessDependenciesOnlyOption(const char* option) { | |
| 323 const char* name = ProcessOption(option, "--dependencies_only"); | |
| 324 if (name == NULL) { | |
| 325 name = ProcessOption(option, "--dependencies-only"); | |
| 326 } | |
| 327 if (name != NULL) { | |
| 328 dependencies_only = true; | |
| 329 return true; | |
| 330 } | |
| 331 return false; | |
| 332 } | |
| 333 | |
| 334 | |
| 307 static bool ProcessEmbedderEntryPointsManifestOption(const char* option) { | 335 static bool ProcessEmbedderEntryPointsManifestOption(const char* option) { |
| 308 const char* name = ProcessOption(option, "--embedder_entry_points_manifest="); | 336 const char* name = ProcessOption(option, "--embedder_entry_points_manifest="); |
| 309 if (name != NULL) { | 337 if (name != NULL) { |
| 310 entry_points_files->AddArgument(name); | 338 entry_points_files->AddArgument(name); |
| 311 return true; | 339 return true; |
| 312 } | 340 } |
| 313 return false; | 341 return false; |
| 314 } | 342 } |
| 315 | 343 |
| 316 | 344 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 // Parse out the vm options. | 398 // Parse out the vm options. |
| 371 while ((i < argc) && IsValidFlag(argv[i], kPrefix, kPrefixLen)) { | 399 while ((i < argc) && IsValidFlag(argv[i], kPrefix, kPrefixLen)) { |
| 372 if (ProcessSnapshotKindOption(argv[i]) || | 400 if (ProcessSnapshotKindOption(argv[i]) || |
| 373 ProcessVmSnapshotDataOption(argv[i]) || | 401 ProcessVmSnapshotDataOption(argv[i]) || |
| 374 ProcessVmSnapshotInstructionsOption(argv[i]) || | 402 ProcessVmSnapshotInstructionsOption(argv[i]) || |
| 375 ProcessIsolateSnapshotDataOption(argv[i]) || | 403 ProcessIsolateSnapshotDataOption(argv[i]) || |
| 376 ProcessIsolateSnapshotInstructionsOption(argv[i]) || | 404 ProcessIsolateSnapshotInstructionsOption(argv[i]) || |
| 377 ProcessAssemblyOption(argv[i]) || | 405 ProcessAssemblyOption(argv[i]) || |
| 378 ProcessScriptSnapshotOption(argv[i]) || | 406 ProcessScriptSnapshotOption(argv[i]) || |
| 379 ProcessDependenciesOption(argv[i]) || | 407 ProcessDependenciesOption(argv[i]) || |
| 408 ProcessDependenciesOnlyOption(argv[i]) || | |
| 380 ProcessEmbedderEntryPointsManifestOption(argv[i]) || | 409 ProcessEmbedderEntryPointsManifestOption(argv[i]) || |
| 381 ProcessURLmappingOption(argv[i]) || ProcessPackageRootOption(argv[i]) || | 410 ProcessURLmappingOption(argv[i]) || ProcessPackageRootOption(argv[i]) || |
| 382 ProcessPackagesOption(argv[i]) || ProcessEnvironmentOption(argv[i])) { | 411 ProcessPackagesOption(argv[i]) || ProcessEnvironmentOption(argv[i])) { |
| 383 i += 1; | 412 i += 1; |
| 384 continue; | 413 continue; |
| 385 } | 414 } |
| 386 vm_options->AddArgument(argv[i]); | 415 vm_options->AddArgument(argv[i]); |
| 387 i += 1; | 416 i += 1; |
| 388 } | 417 } |
| 389 | 418 |
| 390 // Get the script name. | 419 // Get the script name. |
| 391 if (i < argc) { | 420 if (i < argc) { |
| 392 *script_name = argv[i]; | 421 *script_name = argv[i]; |
| 393 i += 1; | 422 i += 1; |
| 394 } else { | 423 } else { |
| 395 *script_name = NULL; | 424 *script_name = NULL; |
| 396 } | 425 } |
| 397 | 426 |
| 398 // Verify consistency of arguments. | 427 // Verify consistency of arguments. |
| 399 if ((commandline_package_root != NULL) && | 428 if ((commandline_package_root != NULL) && |
| 400 (commandline_packages_file != NULL)) { | 429 (commandline_packages_file != NULL)) { |
| 401 Log::PrintErr( | 430 Log::PrintErr( |
| 402 "Specifying both a packages directory and a packages " | 431 "Specifying both a packages directory and a packages " |
| 403 "file is invalid.\n\n"); | 432 "file is invalid.\n\n"); |
| 404 return -1; | 433 return -1; |
| 405 } | 434 } |
| 406 | 435 |
| 407 switch (snapshot_kind) { | 436 switch (snapshot_kind) { |
| 408 case kNone: { | |
| 409 if (*script_name == NULL) { | |
| 410 Log::PrintErr( | |
| 411 "Building without snapshot generation requires a Dart " | |
| 412 "script.\n\n"); | |
| 413 return -1; | |
| 414 } | |
| 415 break; | |
| 416 } | |
| 417 case kCore: { | 437 case kCore: { |
| 418 if ((vm_snapshot_data_filename == NULL) || | 438 if ((vm_snapshot_data_filename == NULL) || |
| 419 (isolate_snapshot_data_filename == NULL)) { | 439 (isolate_snapshot_data_filename == NULL)) { |
| 420 Log::PrintErr( | 440 Log::PrintErr( |
| 421 "Building a core snapshot requires specifying output files for " | 441 "Building a core snapshot requires specifying output files for " |
| 422 "--vm_snapshot_data and --isolate_snapshot_data.\n\n"); | 442 "--vm_snapshot_data and --isolate_snapshot_data.\n\n"); |
| 423 return -1; | 443 return -1; |
| 424 } | 444 } |
| 425 break; | 445 break; |
| 426 } | 446 } |
| 427 case kScript: { | 447 case kScript: { |
| 428 if ((vm_snapshot_data_filename == NULL) || | 448 if ((vm_snapshot_data_filename == NULL) || |
| 429 (isolate_snapshot_data_filename == NULL) || | 449 (isolate_snapshot_data_filename == NULL) || |
| 430 (script_snapshot_filename == NULL) || (*script_name == NULL)) { | 450 (script_snapshot_filename == NULL) || (*script_name == NULL)) { |
| 431 Log::PrintErr( | 451 Log::PrintErr( |
| 432 "Building a script snapshot requires specifying input files for " | 452 "Building a script snapshot requires specifying input files for " |
| 433 "--vm_snapshot_data and --isolate_snapshot_data, an output file " | 453 "--vm_snapshot_data and --isolate_snapshot_data, an output file " |
| 434 "for --script-snapshot, and a Dart script.\n\n"); | 454 "for --script_snapshot, and a Dart script.\n\n"); |
| 435 return -1; | 455 return -1; |
| 436 } | 456 } |
| 437 break; | 457 break; |
| 438 } | 458 } |
| 439 case kAppAOTBlobs: { | 459 case kAppAOTBlobs: { |
| 440 if ((vm_snapshot_data_filename == NULL) || | 460 if ((vm_snapshot_data_filename == NULL) || |
| 441 (vm_snapshot_instructions_filename == NULL) || | 461 (vm_snapshot_instructions_filename == NULL) || |
| 442 (isolate_snapshot_data_filename == NULL) || | 462 (isolate_snapshot_data_filename == NULL) || |
| 443 (isolate_snapshot_instructions_filename == NULL) || | 463 (isolate_snapshot_instructions_filename == NULL) || |
| 444 (*script_name == NULL)) { | 464 (*script_name == NULL)) { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 ASSERT(dependencies_filename != NULL); | 676 ASSERT(dependencies_filename != NULL); |
| 657 File* file = File::Open(dependencies_filename, File::kWriteTruncate); | 677 File* file = File::Open(dependencies_filename, File::kWriteTruncate); |
| 658 if (file == NULL) { | 678 if (file == NULL) { |
| 659 Log::PrintErr("Error: Unable to open dependencies file: %s\n\n", | 679 Log::PrintErr("Error: Unable to open dependencies file: %s\n\n", |
| 660 dependencies_filename); | 680 dependencies_filename); |
| 661 exit(kErrorExitCode); | 681 exit(kErrorExitCode); |
| 662 } | 682 } |
| 663 bool success = true; | 683 bool success = true; |
| 664 | 684 |
| 665 // Targets: | 685 // Targets: |
| 666 if (vm_snapshot_data_filename != NULL) { | 686 switch (snapshot_kind) { |
| 667 success &= | 687 case kCore: |
| 668 file->Print("%s ", File::GetCanonicalPath(vm_snapshot_data_filename)); | 688 success &= file->Print("%s ", vm_snapshot_data_filename); |
| 669 } | 689 success &= file->Print("%s ", isolate_snapshot_data_filename); |
| 670 if (vm_snapshot_instructions_filename != NULL) { | 690 break; |
| 671 success &= file->Print( | 691 case kScript: |
| 672 "%s ", File::GetCanonicalPath(vm_snapshot_instructions_filename)); | 692 success &= file->Print("%s ", script_snapshot_filename); |
| 673 } | 693 break; |
| 674 if (isolate_snapshot_data_filename != NULL) { | 694 case kAppAOTAssembly: |
| 675 success &= file->Print( | 695 success &= file->Print("%s ", assembly_filename); |
| 676 "%s ", File::GetCanonicalPath(isolate_snapshot_data_filename)); | 696 break; |
| 677 } | 697 case kAppAOTBlobs: |
| 678 if (isolate_snapshot_instructions_filename != NULL) { | 698 success &= file->Print("%s ", vm_snapshot_data_filename); |
| 679 success &= file->Print( | 699 success &= file->Print("%s ", vm_snapshot_instructions_filename); |
| 680 "%s ", File::GetCanonicalPath(isolate_snapshot_instructions_filename)); | 700 success &= file->Print("%s ", isolate_snapshot_data_filename); |
| 681 } | 701 success &= file->Print("%s ", isolate_snapshot_instructions_filename); |
| 682 if (assembly_filename != NULL) { | 702 break; |
| 683 success &= file->Print("%s ", File::GetCanonicalPath(assembly_filename)); | |
| 684 } | |
| 685 if (script_snapshot_filename != NULL) { | |
| 686 success &= | |
| 687 file->Print("%s ", File::GetCanonicalPath(script_snapshot_filename)); | |
| 688 } | 703 } |
| 689 | 704 |
| 690 success &= file->Print(": "); | 705 success &= file->Print(": "); |
| 691 | 706 |
| 692 // Sources: | 707 // Sources: |
| 708 if (snapshot_kind == kScript) { | |
| 709 success &= file->Print("%s ", vm_snapshot_data_filename); | |
| 710 success &= file->Print("%s ", isolate_snapshot_data_filename); | |
| 711 } | |
| 693 for (intptr_t i = 0; i < dependencies->length(); i++) { | 712 for (intptr_t i = 0; i < dependencies->length(); i++) { |
| 694 char* dep = dependencies->At(i); | 713 char* dep = dependencies->At(i); |
| 695 success &= file->Print("%s ", dep); | 714 success &= file->Print("%s ", dep); |
| 696 free(dep); | 715 free(dep); |
| 697 } | 716 } |
| 698 success &= file->Print("\n"); | 717 success &= file->Print("\n"); |
| 699 | 718 |
| 700 if (!success) { | 719 if (!success) { |
| 701 Log::PrintErr("Error: Unable to write dependencies file: %s\n\n", | 720 Log::PrintErr("Error: Unable to write dependencies file: %s\n\n", |
| 702 dependencies_filename); | 721 dependencies_filename); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 " package:... imports. \n" | 832 " package:... imports. \n" |
| 814 " \n" | 833 " \n" |
| 815 " --packages=<packages_file> Where to find a package spec file \n" | 834 " --packages=<packages_file> Where to find a package spec file \n" |
| 816 " \n" | 835 " \n" |
| 817 " --url_mapping=<mapping> Uses the URL mapping(s) specified on \n" | 836 " --url_mapping=<mapping> Uses the URL mapping(s) specified on \n" |
| 818 " the command line to load the \n" | 837 " the command line to load the \n" |
| 819 " libraries. \n" | 838 " libraries. \n" |
| 820 " --dependencies=<output-file> Generates a Makefile with snapshot output \n" | 839 " --dependencies=<output-file> Generates a Makefile with snapshot output \n" |
| 821 " files as targets and all transitive imports\n" | 840 " files as targets and all transitive imports\n" |
| 822 " as sources. \n" | 841 " as sources. \n" |
| 823 " \n" | 842 " --dependencies_only Don't create and output the snapshot. \n" |
| 824 " To discover dependencies without generating a snapshot: \n" | |
| 825 " --snapshot_kind=none \n" | |
| 826 " --dependencies=<output-file> \n" | |
| 827 " <dart-script-file> \n" | |
| 828 " \n" | 843 " \n" |
| 829 " To create a core snapshot: \n" | 844 " To create a core snapshot: \n" |
| 830 " --snapshot_kind=core \n" | 845 " --snapshot_kind=core \n" |
| 831 " --vm_snapshot_data=<output-file> \n" | 846 " --vm_snapshot_data=<output-file> \n" |
| 832 " --isolate_snapshot_data=<output-file> \n" | 847 " --isolate_snapshot_data=<output-file> \n" |
| 833 " [<dart-script-file>] \n" | 848 " [<dart-script-file>] \n" |
| 834 " \n" | 849 " \n" |
| 835 " Writes a snapshot of <dart-script-file> to the specified snapshot files. \n" | 850 " Writes a snapshot of <dart-script-file> to the specified snapshot files. \n" |
| 836 " If no <dart-script-file> is passed, a generic snapshot of all the corelibs \n" | 851 " If no <dart-script-file> is passed, a generic snapshot of all the corelibs \n" |
| 837 " is created. \n" | 852 " is created. \n" |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1606 library = LoadSnapshotCreationScript(app_script_name); | 1621 library = LoadSnapshotCreationScript(app_script_name); |
| 1607 CHECK_RESULT(library); | 1622 CHECK_RESULT(library); |
| 1608 | 1623 |
| 1609 ImportNativeEntryPointLibrariesIntoRoot(entry_points); | 1624 ImportNativeEntryPointLibrariesIntoRoot(entry_points); |
| 1610 } | 1625 } |
| 1611 | 1626 |
| 1612 // Ensure that we mark all libraries as loaded. | 1627 // Ensure that we mark all libraries as loaded. |
| 1613 result = Dart_FinalizeLoading(false); | 1628 result = Dart_FinalizeLoading(false); |
| 1614 CHECK_RESULT(result); | 1629 CHECK_RESULT(result); |
| 1615 | 1630 |
| 1616 switch (snapshot_kind) { | 1631 if (!dependencies_only) { |
| 1617 case kNone: | 1632 switch (snapshot_kind) { |
| 1618 break; | 1633 case kCore: |
| 1619 case kCore: | 1634 CreateAndWriteCoreSnapshot(); |
| 1620 CreateAndWriteCoreSnapshot(); | 1635 break; |
| 1621 break; | 1636 case kScript: |
| 1622 case kScript: | 1637 CreateAndWriteScriptSnapshot(); |
| 1623 CreateAndWriteScriptSnapshot(); | 1638 break; |
| 1624 break; | 1639 case kAppAOTBlobs: |
| 1625 case kAppAOTBlobs: | 1640 case kAppAOTAssembly: |
| 1626 case kAppAOTAssembly: | 1641 CreateAndWritePrecompiledSnapshot(entry_points); |
| 1627 CreateAndWritePrecompiledSnapshot(entry_points); | 1642 break; |
| 1628 break; | 1643 default: |
| 1629 default: | 1644 UNREACHABLE(); |
| 1630 UNREACHABLE(); | 1645 } |
| 1631 } | 1646 } |
| 1632 | 1647 |
| 1633 CreateAndWriteDependenciesFile(); | 1648 CreateAndWriteDependenciesFile(); |
| 1634 | 1649 |
| 1635 Dart_ExitScope(); | 1650 Dart_ExitScope(); |
| 1636 Dart_ShutdownIsolate(); | 1651 Dart_ShutdownIsolate(); |
| 1637 | 1652 |
| 1638 CleanupEntryPointsCollection(entry_points); | 1653 CleanupEntryPointsCollection(entry_points); |
| 1639 | 1654 |
| 1640 Dart_EnterIsolate(UriResolverIsolateScope::isolate); | 1655 Dart_EnterIsolate(UriResolverIsolateScope::isolate); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1656 delete mapped_isolate_snapshot_data; | 1671 delete mapped_isolate_snapshot_data; |
| 1657 return 0; | 1672 return 0; |
| 1658 } | 1673 } |
| 1659 | 1674 |
| 1660 } // namespace bin | 1675 } // namespace bin |
| 1661 } // namespace dart | 1676 } // namespace dart |
| 1662 | 1677 |
| 1663 int main(int argc, char** argv) { | 1678 int main(int argc, char** argv) { |
| 1664 return dart::bin::main(argc, argv); | 1679 return dart::bin::main(argc, argv); |
| 1665 } | 1680 } |
| OLD | NEW |