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

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

Issue 2517683002: Don't include usage counters, etc in snapshots with code. If we already have code, eagerly recompil… (Closed)
Patch Set: . Created 4 years, 1 month 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 | « runtime/bin/log_android.cc ('k') | runtime/vm/clustered_snapshot.cc » ('j') | 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Exit code indicating an unhandled error that is not a compilation error. 126 // Exit code indicating an unhandled error that is not a compilation error.
127 static const int kErrorExitCode = 255; 127 static const int kErrorExitCode = 255;
128 // Exit code indicating a vm restart request. Never returned to the user. 128 // Exit code indicating a vm restart request. Never returned to the user.
129 static const int kRestartRequestExitCode = 1000; 129 static const int kRestartRequestExitCode = 1000;
130 130
131 static void ErrorExit(int exit_code, const char* format, ...) { 131 static void ErrorExit(int exit_code, const char* format, ...) {
132 va_list arguments; 132 va_list arguments;
133 va_start(arguments, format); 133 va_start(arguments, format);
134 Log::VPrintErr(format, arguments); 134 Log::VPrintErr(format, arguments);
135 va_end(arguments); 135 va_end(arguments);
136 fflush(stderr);
137 136
siva 2016/11/22 05:23:53 Why did you remove this fflush(stderr); ?
rmacnak 2016/11/22 17:58:45 VPrintErr already does a flush
138 Dart_ExitScope(); 137 Dart_ExitScope();
139 Dart_ShutdownIsolate(); 138 Dart_ShutdownIsolate();
140 139
141 // Terminate process exit-code handler. 140 // Terminate process exit-code handler.
142 Process::TerminateExitCodeHandler(); 141 Process::TerminateExitCodeHandler();
143 142
144 char* error = Dart_Cleanup(); 143 char* error = Dart_Cleanup();
145 if (error != NULL) { 144 if (error != NULL) {
146 Log::PrintErr("VM cleanup failed: %s\n", error); 145 Log::PrintErr("VM cleanup failed: %s\n", error);
147 free(error); 146 free(error);
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 // lookup the main entry point exported from the root library. 1581 // lookup the main entry point exported from the root library.
1583 IsolateData* isolate_data = 1582 IsolateData* isolate_data =
1584 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate)); 1583 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate));
1585 result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib, 1584 result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib,
1586 Dart_Null()); 1585 Dart_Null());
1587 if (is_noopt || (gen_snapshot_kind == kAppAOT) || 1586 if (is_noopt || (gen_snapshot_kind == kAppAOT) ||
1588 (gen_snapshot_kind == kAppJIT)) { 1587 (gen_snapshot_kind == kAppJIT)) {
1589 // Load the embedder's portion of the VM service's Dart code so it will 1588 // Load the embedder's portion of the VM service's Dart code so it will
1590 // be included in the app snapshot. 1589 // be included in the app snapshot.
1591 if (!VmService::LoadForGenPrecompiled()) { 1590 if (!VmService::LoadForGenPrecompiled()) {
1592 fprintf(stderr, "VM service loading failed: %s\n", 1591 Log::PrintErr("VM service loading failed: %s\n",
1593 VmService::GetErrorMessage()); 1592 VmService::GetErrorMessage());
1594 fflush(stderr);
1595 exit(kErrorExitCode); 1593 exit(kErrorExitCode);
1596 } 1594 }
1597 } 1595 }
1598 1596
1599 if (compile_all) { 1597 if (compile_all) {
1600 result = Dart_CompileAll(); 1598 result = Dart_CompileAll();
1601 CHECK_RESULT(result); 1599 CHECK_RESULT(result);
1602 } 1600 }
1603 1601
1604 if (parse_all) { 1602 if (parse_all) {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 Platform::Exit(kErrorExitCode); 1830 Platform::Exit(kErrorExitCode);
1833 } 1831 }
1834 } 1832 }
1835 1833
1836 Thread::InitOnce(); 1834 Thread::InitOnce();
1837 1835
1838 Loader::InitOnce(); 1836 Loader::InitOnce();
1839 1837
1840 if (!DartUtils::SetOriginalWorkingDirectory()) { 1838 if (!DartUtils::SetOriginalWorkingDirectory()) {
1841 OSError err; 1839 OSError err;
1842 fprintf(stderr, "Error determining current directory: %s\n", err.message()); 1840 Log::PrintErr("Error determining current directory: %s\n", err.message());
1843 fflush(stderr);
1844 Platform::Exit(kErrorExitCode); 1841 Platform::Exit(kErrorExitCode);
1845 } 1842 }
1846 1843
1847 const uint8_t* instructions_snapshot = NULL; 1844 const uint8_t* instructions_snapshot = NULL;
1848 const uint8_t* data_snapshot = NULL; 1845 const uint8_t* data_snapshot = NULL;
1849 1846
1850 if (ReadAppSnapshot(script_name, &vm_isolate_snapshot_buffer, 1847 if (ReadAppSnapshot(script_name, &vm_isolate_snapshot_buffer,
1851 &isolate_snapshot_buffer, &instructions_snapshot, 1848 &isolate_snapshot_buffer, &instructions_snapshot,
1852 &data_snapshot)) { 1849 &data_snapshot)) {
1853 run_app_snapshot = true; 1850 run_app_snapshot = true;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 init_params.file_open = DartUtils::OpenFile; 1891 init_params.file_open = DartUtils::OpenFile;
1895 init_params.file_read = DartUtils::ReadFile; 1892 init_params.file_read = DartUtils::ReadFile;
1896 init_params.file_write = DartUtils::WriteFile; 1893 init_params.file_write = DartUtils::WriteFile;
1897 init_params.file_close = DartUtils::CloseFile; 1894 init_params.file_close = DartUtils::CloseFile;
1898 init_params.entropy_source = DartUtils::EntropySource; 1895 init_params.entropy_source = DartUtils::EntropySource;
1899 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; 1896 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback;
1900 1897
1901 char* error = Dart_Initialize(&init_params); 1898 char* error = Dart_Initialize(&init_params);
1902 if (error != NULL) { 1899 if (error != NULL) {
1903 EventHandler::Stop(); 1900 EventHandler::Stop();
1904 fprintf(stderr, "VM initialization failed: %s\n", error); 1901 Log::PrintErr("VM initialization failed: %s\n", error);
1905 fflush(stderr);
1906 free(error); 1902 free(error);
1907 Platform::Exit(kErrorExitCode); 1903 Platform::Exit(kErrorExitCode);
1908 } 1904 }
1909 1905
1910 Dart_RegisterIsolateServiceRequestCallback("getIO", &ServiceGetIOHandler, 1906 Dart_RegisterIsolateServiceRequestCallback("getIO", &ServiceGetIOHandler,
1911 NULL); 1907 NULL);
1912 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, 1908 Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback,
1913 &ServiceStreamCancelCallback); 1909 &ServiceStreamCancelCallback);
1914 Dart_SetFileModifiedCallback(&FileModifiedCallback); 1910 Dart_SetFileModifiedCallback(&FileModifiedCallback);
1915 1911
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 Platform::Exit(Process::GlobalExitCode()); 1944 Platform::Exit(Process::GlobalExitCode());
1949 } 1945 }
1950 1946
1951 } // namespace bin 1947 } // namespace bin
1952 } // namespace dart 1948 } // namespace dart
1953 1949
1954 int main(int argc, char** argv) { 1950 int main(int argc, char** argv) {
1955 dart::bin::main(argc, argv); 1951 dart::bin::main(argc, argv);
1956 UNREACHABLE(); 1952 UNREACHABLE();
1957 } 1953 }
OLDNEW
« no previous file with comments | « runtime/bin/log_android.cc ('k') | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698