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 <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 if (Dart_IsError(result)) { | 415 if (Dart_IsError(result)) { |
416 Log::PrintErr("%s", Dart_GetError(result)); | 416 Log::PrintErr("%s", Dart_GetError(result)); |
417 Dart_ExitScope(); | 417 Dart_ExitScope(); |
418 Dart_ShutdownIsolate(); | 418 Dart_ShutdownIsolate(); |
419 exit(255); | 419 exit(255); |
420 } | 420 } |
421 // This is a generic dart snapshot which needs builtin library setup. | 421 // This is a generic dart snapshot which needs builtin library setup. |
422 Dart_Handle library = | 422 Dart_Handle library = |
423 LoadGenericSnapshotCreationScript(Builtin::kBuiltinLibrary); | 423 LoadGenericSnapshotCreationScript(Builtin::kBuiltinLibrary); |
424 VerifyLoaded(library); | 424 VerifyLoaded(library); |
425 library = LoadGenericSnapshotCreationScript(Builtin::kUriLibrary); | |
426 VerifyLoaded(library); | |
427 library = LoadGenericSnapshotCreationScript(Builtin::kUtfLibrary); | |
428 VerifyLoaded(library); | |
429 } | 425 } |
430 | 426 |
431 | 427 |
432 static void SetupForGenericSnapshotCreation() { | 428 static void SetupForGenericSnapshotCreation() { |
433 SetupForUriResolution(); | 429 SetupForUriResolution(); |
434 | 430 |
435 Dart_Handle library = | |
436 LoadGenericSnapshotCreationScript(Builtin::kJsonLibrary); | |
437 VerifyLoaded(library); | |
438 library = LoadGenericSnapshotCreationScript(Builtin::kCryptoLibrary); | |
439 VerifyLoaded(library); | |
440 // TODO(regis): Reenable this code for arm and mips when possible. | 431 // TODO(regis): Reenable this code for arm and mips when possible. |
441 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 432 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
442 library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary); | 433 Dart_Handle library = LoadGenericSnapshotCreationScript(Builtin::kIOLibrary); |
443 VerifyLoaded(library); | 434 VerifyLoaded(library); |
444 #endif | 435 #endif |
445 } | 436 } |
446 | 437 |
447 | 438 |
448 int main(int argc, char** argv) { | 439 int main(int argc, char** argv) { |
449 CommandLineOptions vm_options(argc); | 440 CommandLineOptions vm_options(argc); |
450 | 441 |
451 // Initialize the URL mapping array. | 442 // Initialize the URL mapping array. |
452 CommandLineOptions url_mapping_array(argc); | 443 CommandLineOptions url_mapping_array(argc); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 CreateAndWriteSnapshot(); | 519 CreateAndWriteSnapshot(); |
529 | 520 |
530 Dart_EnterIsolate(UriResolverIsolateScope::isolate); | 521 Dart_EnterIsolate(UriResolverIsolateScope::isolate); |
531 Dart_ShutdownIsolate(); | 522 Dart_ShutdownIsolate(); |
532 } else { | 523 } else { |
533 SetupForGenericSnapshotCreation(); | 524 SetupForGenericSnapshotCreation(); |
534 CreateAndWriteSnapshot(); | 525 CreateAndWriteSnapshot(); |
535 } | 526 } |
536 return 0; | 527 return 0; |
537 } | 528 } |
OLD | NEW |