Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(791)

Side by Side Diff: runtime/bin/main.cc

Issue 2662213004: Do not try to read vm-service and kernel-service (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 isolate_run_app_snapshot = true; 855 isolate_run_app_snapshot = true;
856 isolate_snapshot_data = app_isolate_snapshot_data; 856 isolate_snapshot_data = app_isolate_snapshot_data;
857 isolate_snapshot_instructions = app_isolate_snapshot_instructions; 857 isolate_snapshot_instructions = app_isolate_snapshot_instructions;
858 } 858 }
859 #endif 859 #endif
860 860
861 const uint8_t* kernel_file = NULL; 861 const uint8_t* kernel_file = NULL;
862 intptr_t kernel_length = -1; 862 intptr_t kernel_length = -1;
863 bool is_kernel = false; 863 bool is_kernel = false;
864 864
865 if (use_dart_frontend && !is_kernel_isolate && !is_service_isolate) { 865 if (!is_kernel_isolate && !is_service_isolate) {
866 Dart_KernelCompilationResult result = Dart_CompileToKernel(script_uri); 866 if (use_dart_frontend) {
867 *error = result.error; // Copy error message (if any). 867 Dart_KernelCompilationResult result = Dart_CompileToKernel(script_uri);
868 switch (result.status) { 868 *error = result.error; // Copy error message (if any).
869 case Dart_KernelCompilationStatus_Ok: 869 switch (result.status) {
870 is_kernel = true; 870 case Dart_KernelCompilationStatus_Ok:
871 kernel_file = result.kernel; 871 is_kernel = true;
872 kernel_length = result.kernel_size; 872 kernel_file = result.kernel;
873 break; 873 kernel_length = result.kernel_size;
874 case Dart_KernelCompilationStatus_Error: 874 break;
875 *exit_code = kCompilationErrorExitCode; 875 case Dart_KernelCompilationStatus_Error:
876 return NULL; 876 *exit_code = kCompilationErrorExitCode;
877 case Dart_KernelCompilationStatus_Crash: 877 return NULL;
878 *exit_code = kDartFrontendErrorExitCode; 878 case Dart_KernelCompilationStatus_Crash:
879 return NULL; 879 *exit_code = kDartFrontendErrorExitCode;
880 case Dart_KernelCompilationStatus_Unknown: 880 return NULL;
881 *exit_code = kErrorExitCode; 881 case Dart_KernelCompilationStatus_Unknown:
882 return NULL; 882 *exit_code = kErrorExitCode;
883 return NULL;
884 }
885 } else if (!isolate_run_app_snapshot) {
886 is_kernel = TryReadKernel(script_uri, &kernel_file, &kernel_length);
883 } 887 }
884 } 888 }
885 889
886 // If the script is a Kernel binary, then we will try to bootstrap from the
887 // script.
888 if (!is_kernel && !isolate_run_app_snapshot) {
889 is_kernel = TryReadKernel(script_uri, &kernel_file, &kernel_length);
Kevin Millikin (Google) 2017/02/01 11:45:45 This was not guarded by !is_kernel_isolate && !is_
890 }
891
892 void* kernel_program = NULL; 890 void* kernel_program = NULL;
893 if (is_kernel) { 891 if (is_kernel) {
894 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length); 892 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length);
895 free(const_cast<uint8_t*>(kernel_file)); 893 free(const_cast<uint8_t*>(kernel_file));
896 } 894 }
897 895
898 IsolateData* isolate_data = 896 IsolateData* isolate_data =
899 new IsolateData(script_uri, package_root, packages_config); 897 new IsolateData(script_uri, package_root, packages_config);
898 // If the script is a Kernel binary, then we will try to bootstrap from the
899 // script.
900 Dart_Isolate isolate = 900 Dart_Isolate isolate =
901 is_kernel ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_program, 901 is_kernel ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_program,
902 flags, isolate_data, error) 902 flags, isolate_data, error)
903 : Dart_CreateIsolate(script_uri, main, isolate_snapshot_data, 903 : Dart_CreateIsolate(script_uri, main, isolate_snapshot_data,
904 isolate_snapshot_instructions, flags, 904 isolate_snapshot_instructions, flags,
905 isolate_data, error); 905 isolate_data, error);
906 if (isolate == NULL) { 906 if (isolate == NULL) {
907 delete isolate_data; 907 delete isolate_data;
908 return NULL; 908 return NULL;
909 } 909 }
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 Platform::Exit(Process::GlobalExitCode()); 2087 Platform::Exit(Process::GlobalExitCode());
2088 } 2088 }
2089 2089
2090 } // namespace bin 2090 } // namespace bin
2091 } // namespace dart 2091 } // namespace dart
2092 2092
2093 int main(int argc, char** argv) { 2093 int main(int argc, char** argv) {
2094 dart::bin::main(argc, argv); 2094 dart::bin::main(argc, argv);
2095 UNREACHABLE(); 2095 UNREACHABLE();
2096 } 2096 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698