| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 // Prepare builtin and other core libraries for use to resolve URIs. | 841 // Prepare builtin and other core libraries for use to resolve URIs. |
| 842 // Set up various closures, e.g: printing, timers etc. | 842 // Set up various closures, e.g: printing, timers etc. |
| 843 // Set up 'package root' for URI resolution. | 843 // Set up 'package root' for URI resolution. |
| 844 result = DartUtils::PrepareForScriptLoading(false, trace_loading); | 844 result = DartUtils::PrepareForScriptLoading(false, trace_loading); |
| 845 CHECK_RESULT(result); | 845 CHECK_RESULT(result); |
| 846 | 846 |
| 847 #if !defined(DART_PRECOMPILED_RUNTIME) | 847 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 848 if (dfe.kernel_file_specified()) { | 848 if (dfe.kernel_file_specified()) { |
| 849 ASSERT(kernel_program != NULL); | 849 ASSERT(kernel_program != NULL); |
| 850 result = Dart_LoadKernel(kernel_program); | 850 result = Dart_LoadKernel(kernel_program); |
| 851 isolate_data->kernel_program = NULL; // Dart_LoadKernel takes ownership. |
| 851 } else { | 852 } else { |
| 852 if (kernel_program != NULL) { | 853 if (kernel_program != NULL) { |
| 853 Dart_Handle uri = Dart_NewStringFromCString(script_uri); | 854 Dart_Handle uri = Dart_NewStringFromCString(script_uri); |
| 854 CHECK_RESULT(uri); | 855 CHECK_RESULT(uri); |
| 855 Dart_Handle resolved_script_uri = DartUtils::ResolveScript(uri); | 856 Dart_Handle resolved_script_uri = DartUtils::ResolveScript(uri); |
| 856 CHECK_RESULT(resolved_script_uri); | 857 CHECK_RESULT(resolved_script_uri); |
| 857 result = | 858 result = |
| 858 Dart_LoadScript(uri, resolved_script_uri, | 859 Dart_LoadScript(uri, resolved_script_uri, |
| 859 reinterpret_cast<Dart_Handle>(kernel_program), 0, 0); | 860 reinterpret_cast<Dart_Handle>(kernel_program), 0, 0); |
| 861 isolate_data->kernel_program = NULL; // Dart_LoadScript takes ownership. |
| 860 CHECK_RESULT(result); | 862 CHECK_RESULT(result); |
| 861 } | 863 } |
| 862 } | 864 } |
| 863 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 865 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 864 | 866 |
| 865 if (set_native_resolvers) { | 867 if (set_native_resolvers) { |
| 866 // Setup the native resolver as the snapshot does not carry it. | 868 // Setup the native resolver as the snapshot does not carry it. |
| 867 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 869 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
| 868 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 870 Builtin::SetNativeResolver(Builtin::kIOLibrary); |
| 869 } | 871 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1042 |
| 1041 Dart_EnterScope(); | 1043 Dart_EnterScope(); |
| 1042 | 1044 |
| 1043 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); | 1045 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); |
| 1044 CHECK_RESULT(result); | 1046 CHECK_RESULT(result); |
| 1045 | 1047 |
| 1046 #if !defined(DART_PRECOMPILED_RUNTIME) | 1048 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1047 if (dfe.UsePlatformBinary()) { | 1049 if (dfe.UsePlatformBinary()) { |
| 1048 Dart_Handle library = Dart_LoadKernel(dfe.kernel_vmservice_io()); | 1050 Dart_Handle library = Dart_LoadKernel(dfe.kernel_vmservice_io()); |
| 1049 CHECK_RESULT_CLEANUP(library, isolate_data); | 1051 CHECK_RESULT_CLEANUP(library, isolate_data); |
| 1052 dfe.unset_kernel_vmservice_io(); // Dart_LoadKernel takes ownership. |
| 1050 skip_library_load = true; | 1053 skip_library_load = true; |
| 1051 } | 1054 } |
| 1052 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1055 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1053 | 1056 |
| 1054 // Load embedder specific bits and return. | 1057 // Load embedder specific bits and return. |
| 1055 if (!VmService::Setup(vm_service_server_ip, vm_service_server_port, | 1058 if (!VmService::Setup(vm_service_server_ip, vm_service_server_port, |
| 1056 skip_library_load, vm_service_dev_mode, | 1059 skip_library_load, vm_service_dev_mode, |
| 1057 trace_loading)) { | 1060 trace_loading)) { |
| 1058 *error = strdup(VmService::GetErrorMessage()); | 1061 *error = strdup(VmService::GetErrorMessage()); |
| 1059 return NULL; | 1062 return NULL; |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 Platform::Exit(Process::GlobalExitCode()); | 1907 Platform::Exit(Process::GlobalExitCode()); |
| 1905 } | 1908 } |
| 1906 | 1909 |
| 1907 } // namespace bin | 1910 } // namespace bin |
| 1908 } // namespace dart | 1911 } // namespace dart |
| 1909 | 1912 |
| 1910 int main(int argc, char** argv) { | 1913 int main(int argc, char** argv) { |
| 1911 dart::bin::main(argc, argv); | 1914 dart::bin::main(argc, argv); |
| 1912 UNREACHABLE(); | 1915 UNREACHABLE(); |
| 1913 } | 1916 } |
| OLD | NEW |