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

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

Issue 533073005: Reduce service isolate startup time from ~80ms to ~30ms (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/process_patch.dart » ('j') | runtime/bin/vmservice_impl.cc » ('J')
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_debugger_api.h" 10 #include "include/dart_debugger_api.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 static bool has_print_script = false; 66 static bool has_print_script = false;
67 67
68 68
69 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1"; 69 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1";
70 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181; 70 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181;
71 // VM Service options. 71 // VM Service options.
72 static bool start_vm_service = false; 72 static bool start_vm_service = false;
73 static const char* vm_service_server_ip = DEFAULT_VM_SERVICE_SERVER_IP; 73 static const char* vm_service_server_ip = DEFAULT_VM_SERVICE_SERVER_IP;
74 // The 0 port is a magic value which results in the first available port 74 // The 0 port is a magic value which results in the first available port
75 // being allocated. 75 // being allocated.
76 static int vm_service_server_port = 0; 76 static int vm_service_server_port = -1;
77 77
78 // The environment provided through the command line using -D options. 78 // The environment provided through the command line using -D options.
79 static dart::HashMap* environment = NULL; 79 static dart::HashMap* environment = NULL;
80 80
81 static bool IsValidFlag(const char* name, 81 static bool IsValidFlag(const char* name,
82 const char* prefix, 82 const char* prefix,
83 intptr_t prefix_length) { 83 intptr_t prefix_length) {
84 intptr_t name_length = strlen(name); 84 intptr_t name_length = strlen(name);
85 return ((name_length > prefix_length) && 85 return ((name_length > prefix_length) &&
86 (strncmp(name, prefix, prefix_length) == 0)); 86 (strncmp(name, prefix, prefix_length) == 0));
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 result = Dart_SetEnvironmentCallback(EnvironmentCallback); 689 result = Dart_SetEnvironmentCallback(EnvironmentCallback);
690 CHECK_RESULT(result); 690 CHECK_RESULT(result);
691 // Prepare builtin and its dependent libraries for use to resolve URIs. 691 // Prepare builtin and its dependent libraries for use to resolve URIs.
692 Dart_Handle builtin_lib = 692 Dart_Handle builtin_lib =
693 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 693 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
694 CHECK_RESULT(builtin_lib); 694 CHECK_RESULT(builtin_lib);
695 // Prepare for script loading by setting up the 'print' and 'timer' 695 // Prepare for script loading by setting up the 'print' and 'timer'
696 // closures and setting up 'package root' for URI resolution. 696 // closures and setting up 'package root' for URI resolution.
697 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib); 697 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib);
698 CHECK_RESULT(result); 698 CHECK_RESULT(result);
699 Platform::SetPackageRoot(package_root); 699
700 Dart_Handle io_lib_url = DartUtils::NewString(DartUtils::kIOLibURL);
701 CHECK_RESULT(io_lib_url);
702 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url);
703 CHECK_RESULT(io_lib);
704 Dart_Handle platform_type = DartUtils::GetDartType(DartUtils::kIOLibURL,
705 "_Platform");
706 CHECK_RESULT(platform_type);
707 Dart_Handle script_name = DartUtils::NewString("_nativeScript");
708 CHECK_RESULT(script_name);
709 Dart_Handle dart_script = DartUtils::NewString(script_uri);
710 CHECK_RESULT(dart_script);
711 Dart_Handle set_script_name =
712 Dart_SetField(platform_type, script_name, dart_script);
713 CHECK_RESULT(set_script_name);
714 Dart_ExitScope(); 700 Dart_ExitScope();
715 Dart_ExitIsolate(); 701 Dart_ExitIsolate();
716 return isolate; 702 return isolate;
717 } 703 }
718 704
719 #undef CHECK_RESULT 705 #undef CHECK_RESULT
720 706
721 static void PrintVersion() { 707 static void PrintVersion() {
722 Log::PrintErr("Dart VM version: %s\n", Dart_VersionString()); 708 Log::PrintErr("Dart VM version: %s\n", Dart_VersionString());
723 } 709 }
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 exit(Process::GlobalExitCode()); 1156 exit(Process::GlobalExitCode());
1171 } 1157 }
1172 1158
1173 } // namespace bin 1159 } // namespace bin
1174 } // namespace dart 1160 } // namespace dart
1175 1161
1176 int main(int argc, char** argv) { 1162 int main(int argc, char** argv) {
1177 dart::bin::main(argc, argv); 1163 dart::bin::main(argc, argv);
1178 UNREACHABLE(); 1164 UNREACHABLE();
1179 } 1165 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/process_patch.dart » ('j') | runtime/bin/vmservice_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698