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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 Dart_Handle script_path = FilePathFromUri( | 428 Dart_Handle script_path = FilePathFromUri( |
429 DartUtils::GetStringValue(resolved_script_uri)); | 429 DartUtils::GetStringValue(resolved_script_uri)); |
430 if (Dart_IsError(script_path)) { | 430 if (Dart_IsError(script_path)) { |
431 return script_path; | 431 return script_path; |
432 } | 432 } |
433 Dart_Handle source = DartUtils::ReadStringFromFile( | 433 Dart_Handle source = DartUtils::ReadStringFromFile( |
434 DartUtils::GetStringValue(script_path)); | 434 DartUtils::GetStringValue(script_path)); |
435 if (Dart_IsError(source)) { | 435 if (Dart_IsError(source)) { |
436 return source; | 436 return source; |
437 } | 437 } |
438 return Dart_LoadLibrary(resolved_script_uri, source, 0, 0); | 438 if (IsSnapshottingForPrecompilation()) { |
| 439 return Dart_LoadScript(resolved_script_uri, source, 0, 0); |
| 440 } else { |
| 441 return Dart_LoadLibrary(resolved_script_uri, source, 0, 0); |
| 442 } |
439 } | 443 } |
440 | 444 |
441 | 445 |
442 static Dart_Handle LoadGenericSnapshotCreationScript( | 446 static Dart_Handle LoadGenericSnapshotCreationScript( |
443 Builtin::BuiltinLibraryId id) { | 447 Builtin::BuiltinLibraryId id) { |
444 Dart_Handle source = Builtin::Source(id); | 448 Dart_Handle source = Builtin::Source(id); |
445 if (Dart_IsError(source)) { | 449 if (Dart_IsError(source)) { |
446 return source; // source contains the error string. | 450 return source; // source contains the error string. |
447 } | 451 } |
448 Dart_Handle lib; | 452 Dart_Handle lib; |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 EventHandler::Stop(); | 1141 EventHandler::Stop(); |
1138 return 0; | 1142 return 0; |
1139 } | 1143 } |
1140 | 1144 |
1141 } // namespace bin | 1145 } // namespace bin |
1142 } // namespace dart | 1146 } // namespace dart |
1143 | 1147 |
1144 int main(int argc, char** argv) { | 1148 int main(int argc, char** argv) { |
1145 return dart::bin::main(argc, argv); | 1149 return dart::bin::main(argc, argv); |
1146 } | 1150 } |
OLD | NEW |