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

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') | 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_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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 result = Dart_SetEnvironmentCallback(EnvironmentCallback); 683 result = Dart_SetEnvironmentCallback(EnvironmentCallback);
684 CHECK_RESULT(result); 684 CHECK_RESULT(result);
685 // Prepare builtin and its dependent libraries for use to resolve URIs. 685 // Prepare builtin and its dependent libraries for use to resolve URIs.
686 Dart_Handle builtin_lib = 686 Dart_Handle builtin_lib =
687 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 687 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
688 CHECK_RESULT(builtin_lib); 688 CHECK_RESULT(builtin_lib);
689 // Prepare for script loading by setting up the 'print' and 'timer' 689 // Prepare for script loading by setting up the 'print' and 'timer'
690 // closures and setting up 'package root' for URI resolution. 690 // closures and setting up 'package root' for URI resolution.
691 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib); 691 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib);
692 CHECK_RESULT(result); 692 CHECK_RESULT(result);
693 Platform::SetPackageRoot(package_root); 693
694 Dart_Handle io_lib_url = DartUtils::NewString(DartUtils::kIOLibURL);
695 CHECK_RESULT(io_lib_url);
696 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url);
697 CHECK_RESULT(io_lib);
698 Dart_Handle platform_type = DartUtils::GetDartType(DartUtils::kIOLibURL,
699 "_Platform");
700 CHECK_RESULT(platform_type);
701 Dart_Handle script_name = DartUtils::NewString("_nativeScript");
702 CHECK_RESULT(script_name);
703 Dart_Handle dart_script = DartUtils::NewString(script_uri);
704 CHECK_RESULT(dart_script);
705 Dart_Handle set_script_name =
706 Dart_SetField(platform_type, script_name, dart_script);
707 CHECK_RESULT(set_script_name);
708 Dart_ExitScope(); 694 Dart_ExitScope();
709 Dart_ExitIsolate(); 695 Dart_ExitIsolate();
710 return isolate; 696 return isolate;
711 } 697 }
712 698
713 #undef CHECK_RESULT 699 #undef CHECK_RESULT
714 700
715 static void PrintVersion() { 701 static void PrintVersion() {
716 Log::PrintErr("Dart VM version: %s\n", Dart_VersionString()); 702 Log::PrintErr("Dart VM version: %s\n", Dart_VersionString());
717 } 703 }
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 exit(Process::GlobalExitCode()); 1159 exit(Process::GlobalExitCode());
1174 } 1160 }
1175 1161
1176 } // namespace bin 1162 } // namespace bin
1177 } // namespace dart 1163 } // namespace dart
1178 1164
1179 int main(int argc, char** argv) { 1165 int main(int argc, char** argv) {
1180 dart::bin::main(argc, argv); 1166 dart::bin::main(argc, argv);
1181 UNREACHABLE(); 1167 UNREACHABLE();
1182 } 1168 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/process_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698