| 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 ASSERT(script_uri != NULL); | 585 ASSERT(script_uri != NULL); |
| 586 IsolateData* isolate_data = new IsolateData(script_uri, package_root); | 586 IsolateData* isolate_data = new IsolateData(script_uri, package_root); |
| 587 Dart_Isolate isolate = NULL; | 587 Dart_Isolate isolate = NULL; |
| 588 | 588 |
| 589 isolate = Dart_CreateIsolate(script_uri, | 589 isolate = Dart_CreateIsolate(script_uri, |
| 590 main, | 590 main, |
| 591 isolate_snapshot_buffer, | 591 isolate_snapshot_buffer, |
| 592 isolate_data, | 592 isolate_data, |
| 593 error); | 593 error); |
| 594 | 594 |
| 595 if (isolate == NULL) { | 595 if (isolate == ILLEGAL_ISOLATE) { |
| 596 return NULL; | 596 return ILLEGAL_ISOLATE; |
| 597 } | 597 } |
| 598 | 598 |
| 599 Dart_EnterScope(); | 599 Dart_EnterScope(); |
| 600 | 600 |
| 601 if (isolate_snapshot_buffer != NULL) { | 601 if (isolate_snapshot_buffer != NULL) { |
| 602 // Setup the native resolver as the snapshot does not carry it. | 602 // Setup the native resolver as the snapshot does not carry it. |
| 603 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 603 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
| 604 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 604 Builtin::SetNativeResolver(Builtin::kIOLibrary); |
| 605 } | 605 } |
| 606 | 606 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 // Call CreateIsolateAndSetup which creates an isolate and loads up | 988 // Call CreateIsolateAndSetup which creates an isolate and loads up |
| 989 // the specified application script. | 989 // the specified application script. |
| 990 char* error = NULL; | 990 char* error = NULL; |
| 991 int exit_code = 0; | 991 int exit_code = 0; |
| 992 char* isolate_name = BuildIsolateName(script_name, "main"); | 992 char* isolate_name = BuildIsolateName(script_name, "main"); |
| 993 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, | 993 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, |
| 994 "main", | 994 "main", |
| 995 commandline_package_root, | 995 commandline_package_root, |
| 996 &error, | 996 &error, |
| 997 &exit_code); | 997 &exit_code); |
| 998 if (isolate == NULL) { | 998 if (isolate == ILLEGAL_ISOLATE) { |
| 999 Log::PrintErr("%s\n", error); | 999 Log::PrintErr("%s\n", error); |
| 1000 free(error); | 1000 free(error); |
| 1001 delete [] isolate_name; | 1001 delete [] isolate_name; |
| 1002 exit((exit_code != 0) ? exit_code : kErrorExitCode); | 1002 exit((exit_code != 0) ? exit_code : kErrorExitCode); |
| 1003 } | 1003 } |
| 1004 delete [] isolate_name; | 1004 delete [] isolate_name; |
| 1005 | 1005 |
| 1006 Dart_EnterIsolate(isolate); | 1006 Dart_EnterIsolate(isolate); |
| 1007 ASSERT(isolate == Dart_CurrentIsolate()); | 1007 ASSERT(isolate == Dart_CurrentIsolate()); |
| 1008 ASSERT(isolate != NULL); | 1008 ASSERT(isolate != ILLEGAL_ISOLATE); |
| 1009 Dart_Handle result; | 1009 Dart_Handle result; |
| 1010 | 1010 |
| 1011 Dart_EnterScope(); | 1011 Dart_EnterScope(); |
| 1012 | 1012 |
| 1013 if (generate_script_snapshot) { | 1013 if (generate_script_snapshot) { |
| 1014 // First create a snapshot. | 1014 // First create a snapshot. |
| 1015 Dart_Handle result; | 1015 Dart_Handle result; |
| 1016 uint8_t* buffer = NULL; | 1016 uint8_t* buffer = NULL; |
| 1017 intptr_t size = 0; | 1017 intptr_t size = 0; |
| 1018 result = Dart_CreateScriptSnapshot(&buffer, &size); | 1018 result = Dart_CreateScriptSnapshot(&buffer, &size); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 exit(Process::GlobalExitCode()); | 1123 exit(Process::GlobalExitCode()); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 } // namespace bin | 1126 } // namespace bin |
| 1127 } // namespace dart | 1127 } // namespace dart |
| 1128 | 1128 |
| 1129 int main(int argc, char** argv) { | 1129 int main(int argc, char** argv) { |
| 1130 dart::bin::main(argc, argv); | 1130 dart::bin::main(argc, argv); |
| 1131 UNREACHABLE(); | 1131 UNREACHABLE(); |
| 1132 } | 1132 } |
| OLD | NEW |