| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } | 347 } |
| 348 | 348 |
| 349 #if !defined(DART_PRECOMPILED_RUNTIME) | 349 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 350 static bool ProcessFrontendOption(const char* filename, | 350 static bool ProcessFrontendOption(const char* filename, |
| 351 CommandLineOptions* vm_options) { | 351 CommandLineOptions* vm_options) { |
| 352 ASSERT(filename != NULL); | 352 ASSERT(filename != NULL); |
| 353 if (filename[0] == '\0') { | 353 if (filename[0] == '\0') { |
| 354 return false; | 354 return false; |
| 355 } | 355 } |
| 356 dfe.set_frontend_filename(filename); | 356 dfe.set_frontend_filename(filename); |
| 357 vm_options->AddArgument("--use-dart-frontend"); | |
| 358 return true; | 357 return true; |
| 359 } | 358 } |
| 360 | 359 |
| 361 static bool ProcessKernelBinariesOption(const char* dirname, | 360 static bool ProcessKernelBinariesOption(const char* dirname, |
| 362 CommandLineOptions* vm_options) { | 361 CommandLineOptions* vm_options) { |
| 363 ASSERT(dirname != NULL); | 362 ASSERT(dirname != NULL); |
| 364 if (dirname[0] == '\0') { | 363 if (dirname[0] == '\0') { |
| 365 return false; | 364 return false; |
| 366 } | 365 } |
| 367 dfe.SetKernelBinaries(dirname); | 366 dfe.SetKernelBinaries(dirname); |
| (...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 init_params.vm_snapshot_instructions = vm_snapshot_instructions; | 1845 init_params.vm_snapshot_instructions = vm_snapshot_instructions; |
| 1847 init_params.create = CreateIsolateAndSetup; | 1846 init_params.create = CreateIsolateAndSetup; |
| 1848 init_params.shutdown = OnIsolateShutdown; | 1847 init_params.shutdown = OnIsolateShutdown; |
| 1849 init_params.cleanup = DeleteIsolateData; | 1848 init_params.cleanup = DeleteIsolateData; |
| 1850 init_params.file_open = DartUtils::OpenFile; | 1849 init_params.file_open = DartUtils::OpenFile; |
| 1851 init_params.file_read = DartUtils::ReadFile; | 1850 init_params.file_read = DartUtils::ReadFile; |
| 1852 init_params.file_write = DartUtils::WriteFile; | 1851 init_params.file_write = DartUtils::WriteFile; |
| 1853 init_params.file_close = DartUtils::CloseFile; | 1852 init_params.file_close = DartUtils::CloseFile; |
| 1854 init_params.entropy_source = DartUtils::EntropySource; | 1853 init_params.entropy_source = DartUtils::EntropySource; |
| 1855 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; | 1854 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; |
| 1855 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1856 init_params.start_kernel_isolate = dfe.UseDartFrontend(); |
| 1857 #else |
| 1858 init_params.start_kernel_isolate = false; |
| 1859 #endif |
| 1856 | 1860 |
| 1857 char* error = Dart_Initialize(&init_params); | 1861 char* error = Dart_Initialize(&init_params); |
| 1858 if (error != NULL) { | 1862 if (error != NULL) { |
| 1859 EventHandler::Stop(); | 1863 EventHandler::Stop(); |
| 1860 Log::PrintErr("VM initialization failed: %s\n", error); | 1864 Log::PrintErr("VM initialization failed: %s\n", error); |
| 1861 free(error); | 1865 free(error); |
| 1862 Platform::Exit(kErrorExitCode); | 1866 Platform::Exit(kErrorExitCode); |
| 1863 } | 1867 } |
| 1864 | 1868 |
| 1865 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, | 1869 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 Platform::Exit(Process::GlobalExitCode()); | 1909 Platform::Exit(Process::GlobalExitCode()); |
| 1906 } | 1910 } |
| 1907 | 1911 |
| 1908 } // namespace bin | 1912 } // namespace bin |
| 1909 } // namespace dart | 1913 } // namespace dart |
| 1910 | 1914 |
| 1911 int main(int argc, char** argv) { | 1915 int main(int argc, char** argv) { |
| 1912 dart::bin::main(argc, argv); | 1916 dart::bin::main(argc, argv); |
| 1913 UNREACHABLE(); | 1917 UNREACHABLE(); |
| 1914 } | 1918 } |
| OLD | NEW |