OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 ASSERT(script_uri != NULL); | 584 ASSERT(script_uri != NULL); |
585 IsolateData* isolate_data = new IsolateData(script_uri, package_root); | 585 IsolateData* isolate_data = new IsolateData(script_uri, package_root); |
586 Dart_Isolate isolate = NULL; | 586 Dart_Isolate isolate = NULL; |
587 | 587 |
588 isolate = Dart_CreateIsolate(script_uri, | 588 isolate = Dart_CreateIsolate(script_uri, |
589 main, | 589 main, |
590 isolate_snapshot_buffer, | 590 isolate_snapshot_buffer, |
591 isolate_data, | 591 isolate_data, |
592 error); | 592 error); |
593 | 593 |
594 if (isolate == DART_ILLEGAL_ISOLATE) { | 594 if (isolate == NULL) { |
595 return DART_ILLEGAL_ISOLATE; | 595 return NULL; |
596 } | 596 } |
597 | 597 |
598 Dart_EnterScope(); | 598 Dart_EnterScope(); |
599 | 599 |
600 if (isolate_snapshot_buffer != NULL) { | 600 if (isolate_snapshot_buffer != NULL) { |
601 // Setup the native resolver as the snapshot does not carry it. | 601 // Setup the native resolver as the snapshot does not carry it. |
602 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 602 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
603 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 603 Builtin::SetNativeResolver(Builtin::kIOLibrary); |
604 } | 604 } |
605 | 605 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 // Call CreateIsolateAndSetup which creates an isolate and loads up | 957 // Call CreateIsolateAndSetup which creates an isolate and loads up |
958 // the specified application script. | 958 // the specified application script. |
959 char* error = NULL; | 959 char* error = NULL; |
960 int exit_code = 0; | 960 int exit_code = 0; |
961 char* isolate_name = BuildIsolateName(script_name, "main"); | 961 char* isolate_name = BuildIsolateName(script_name, "main"); |
962 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, | 962 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, |
963 "main", | 963 "main", |
964 commandline_package_root, | 964 commandline_package_root, |
965 &error, | 965 &error, |
966 &exit_code); | 966 &exit_code); |
967 if (isolate == DART_ILLEGAL_ISOLATE) { | 967 if (isolate == NULL) { |
968 Log::PrintErr("%s\n", error); | 968 Log::PrintErr("%s\n", error); |
969 free(error); | 969 free(error); |
970 delete [] isolate_name; | 970 delete [] isolate_name; |
971 exit((exit_code != 0) ? exit_code : kErrorExitCode); | 971 exit((exit_code != 0) ? exit_code : kErrorExitCode); |
972 } | 972 } |
973 delete [] isolate_name; | 973 delete [] isolate_name; |
974 | 974 |
975 Dart_EnterIsolate(isolate); | 975 Dart_EnterIsolate(isolate); |
976 ASSERT(isolate == Dart_CurrentIsolate()); | 976 ASSERT(isolate == Dart_CurrentIsolate()); |
977 ASSERT(isolate != DART_ILLEGAL_ISOLATE); | 977 ASSERT(isolate != NULL); |
978 Dart_Handle result; | 978 Dart_Handle result; |
979 | 979 |
980 Dart_EnterScope(); | 980 Dart_EnterScope(); |
981 | 981 |
982 if (generate_script_snapshot) { | 982 if (generate_script_snapshot) { |
983 // First create a snapshot. | 983 // First create a snapshot. |
984 Dart_Handle result; | 984 Dart_Handle result; |
985 uint8_t* buffer = NULL; | 985 uint8_t* buffer = NULL; |
986 intptr_t size = 0; | 986 intptr_t size = 0; |
987 result = Dart_CreateScriptSnapshot(&buffer, &size); | 987 result = Dart_CreateScriptSnapshot(&buffer, &size); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 exit(Process::GlobalExitCode()); | 1089 exit(Process::GlobalExitCode()); |
1090 } | 1090 } |
1091 | 1091 |
1092 } // namespace bin | 1092 } // namespace bin |
1093 } // namespace dart | 1093 } // namespace dart |
1094 | 1094 |
1095 int main(int argc, char** argv) { | 1095 int main(int argc, char** argv) { |
1096 dart::bin::main(argc, argv); | 1096 dart::bin::main(argc, argv); |
1097 UNREACHABLE(); | 1097 UNREACHABLE(); |
1098 } | 1098 } |
OLD | NEW |