| 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 <stdlib.h> | 6 #include <stdlib.h> |
| 6 #include <string.h> | 7 #include <string.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" |
| 11 | 11 |
| 12 #include "bin/builtin.h" | 12 #include "bin/builtin.h" |
| 13 #include "bin/dartutils.h" | 13 #include "bin/dartutils.h" |
| 14 #include "bin/dfe.h" | 14 #include "bin/dfe.h" |
| 15 #include "bin/directory.h" | 15 #include "bin/directory.h" |
| 16 #include "bin/embedded_dart_io.h" | 16 #include "bin/embedded_dart_io.h" |
| 17 #include "bin/error_exit.h" | 17 #include "bin/error_exit.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Value of the --package-root flag. | 107 // Value of the --package-root flag. |
| 108 // (This pointer points into an argv buffer and does not need to be | 108 // (This pointer points into an argv buffer and does not need to be |
| 109 // free'd.) | 109 // free'd.) |
| 110 static const char* commandline_package_root = NULL; | 110 static const char* commandline_package_root = NULL; |
| 111 | 111 |
| 112 // Value of the --packages flag. | 112 // Value of the --packages flag. |
| 113 // (This pointer points into an argv buffer and does not need to be | 113 // (This pointer points into an argv buffer and does not need to be |
| 114 // free'd.) | 114 // free'd.) |
| 115 static const char* commandline_packages_file = NULL; | 115 static const char* commandline_packages_file = NULL; |
| 116 | 116 |
| 117 | |
| 118 // Global flag that is used to indicate that we want to compile all the | 117 // Global flag that is used to indicate that we want to compile all the |
| 119 // dart functions and not run anything. | 118 // dart functions and not run anything. |
| 120 static bool compile_all = false; | 119 static bool compile_all = false; |
| 121 static bool parse_all = false; | 120 static bool parse_all = false; |
| 122 | 121 |
| 123 | |
| 124 // Global flag that is used to indicate that we want to use blobs/mmap instead | 122 // Global flag that is used to indicate that we want to use blobs/mmap instead |
| 125 // of assembly/shared libraries for precompilation. | 123 // of assembly/shared libraries for precompilation. |
| 126 static bool use_blobs = false; | 124 static bool use_blobs = false; |
| 127 | 125 |
| 128 | |
| 129 // Global flag that is used to indicate that we want to trace resolution of | 126 // Global flag that is used to indicate that we want to trace resolution of |
| 130 // URIs and the loading of libraries, parts and scripts. | 127 // URIs and the loading of libraries, parts and scripts. |
| 131 static bool trace_loading = false; | 128 static bool trace_loading = false; |
| 132 | 129 |
| 133 | |
| 134 static char* app_script_uri = NULL; | 130 static char* app_script_uri = NULL; |
| 135 static const uint8_t* app_isolate_snapshot_data = NULL; | 131 static const uint8_t* app_isolate_snapshot_data = NULL; |
| 136 static const uint8_t* app_isolate_snapshot_instructions = NULL; | 132 static const uint8_t* app_isolate_snapshot_instructions = NULL; |
| 137 | 133 |
| 138 | |
| 139 static Dart_Isolate main_isolate = NULL; | 134 static Dart_Isolate main_isolate = NULL; |
| 140 | 135 |
| 141 | |
| 142 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "localhost"; | 136 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "localhost"; |
| 143 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181; | 137 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181; |
| 144 // VM Service options. | 138 // VM Service options. |
| 145 static const char* vm_service_server_ip = DEFAULT_VM_SERVICE_SERVER_IP; | 139 static const char* vm_service_server_ip = DEFAULT_VM_SERVICE_SERVER_IP; |
| 146 // The 0 port is a magic value which results in the first available port | 140 // The 0 port is a magic value which results in the first available port |
| 147 // being allocated. | 141 // being allocated. |
| 148 static int vm_service_server_port = -1; | 142 static int vm_service_server_port = -1; |
| 149 // True when we are running in development mode and cross origin security | 143 // True when we are running in development mode and cross origin security |
| 150 // checks are disabled. | 144 // checks are disabled. |
| 151 static bool vm_service_dev_mode = false; | 145 static bool vm_service_dev_mode = false; |
| 152 | 146 |
| 153 | |
| 154 // The environment provided through the command line using -D options. | 147 // The environment provided through the command line using -D options. |
| 155 static dart::HashMap* environment = NULL; | 148 static dart::HashMap* environment = NULL; |
| 156 | 149 |
| 157 static bool IsValidFlag(const char* name, | 150 static bool IsValidFlag(const char* name, |
| 158 const char* prefix, | 151 const char* prefix, |
| 159 intptr_t prefix_length) { | 152 intptr_t prefix_length) { |
| 160 intptr_t name_length = strlen(name); | 153 intptr_t name_length = strlen(name); |
| 161 return ((name_length > prefix_length) && | 154 return ((name_length > prefix_length) && |
| 162 (strncmp(name, prefix, prefix_length) == 0)); | 155 (strncmp(name, prefix, prefix_length) == 0)); |
| 163 } | 156 } |
| 164 | 157 |
| 165 | |
| 166 static bool version_option = false; | 158 static bool version_option = false; |
| 167 static bool ProcessVersionOption(const char* arg, | 159 static bool ProcessVersionOption(const char* arg, |
| 168 CommandLineOptions* vm_options) { | 160 CommandLineOptions* vm_options) { |
| 169 if (*arg != '\0') { | 161 if (*arg != '\0') { |
| 170 return false; | 162 return false; |
| 171 } | 163 } |
| 172 version_option = true; | 164 version_option = true; |
| 173 return true; | 165 return true; |
| 174 } | 166 } |
| 175 | 167 |
| 176 | |
| 177 static bool help_option = false; | 168 static bool help_option = false; |
| 178 static bool ProcessHelpOption(const char* arg, CommandLineOptions* vm_options) { | 169 static bool ProcessHelpOption(const char* arg, CommandLineOptions* vm_options) { |
| 179 if (*arg != '\0') { | 170 if (*arg != '\0') { |
| 180 return false; | 171 return false; |
| 181 } | 172 } |
| 182 help_option = true; | 173 help_option = true; |
| 183 return true; | 174 return true; |
| 184 } | 175 } |
| 185 | 176 |
| 186 | |
| 187 static bool verbose_option = false; | 177 static bool verbose_option = false; |
| 188 static bool ProcessVerboseOption(const char* arg, | 178 static bool ProcessVerboseOption(const char* arg, |
| 189 CommandLineOptions* vm_options) { | 179 CommandLineOptions* vm_options) { |
| 190 if (*arg != '\0') { | 180 if (*arg != '\0') { |
| 191 return false; | 181 return false; |
| 192 } | 182 } |
| 193 verbose_option = true; | 183 verbose_option = true; |
| 194 return true; | 184 return true; |
| 195 } | 185 } |
| 196 | 186 |
| 197 | |
| 198 static bool ProcessPackageRootOption(const char* arg, | 187 static bool ProcessPackageRootOption(const char* arg, |
| 199 CommandLineOptions* vm_options) { | 188 CommandLineOptions* vm_options) { |
| 200 ASSERT(arg != NULL); | 189 ASSERT(arg != NULL); |
| 201 if (*arg == '-') { | 190 if (*arg == '-') { |
| 202 return false; | 191 return false; |
| 203 } | 192 } |
| 204 commandline_package_root = arg; | 193 commandline_package_root = arg; |
| 205 return true; | 194 return true; |
| 206 } | 195 } |
| 207 | 196 |
| 208 | |
| 209 static bool ProcessPackagesOption(const char* arg, | 197 static bool ProcessPackagesOption(const char* arg, |
| 210 CommandLineOptions* vm_options) { | 198 CommandLineOptions* vm_options) { |
| 211 ASSERT(arg != NULL); | 199 ASSERT(arg != NULL); |
| 212 if (*arg == '-') { | 200 if (*arg == '-') { |
| 213 return false; | 201 return false; |
| 214 } | 202 } |
| 215 commandline_packages_file = arg; | 203 commandline_packages_file = arg; |
| 216 return true; | 204 return true; |
| 217 } | 205 } |
| 218 | 206 |
| 219 | |
| 220 static bool ProcessSaveCompilationTraceOption(const char* arg, | 207 static bool ProcessSaveCompilationTraceOption(const char* arg, |
| 221 CommandLineOptions* vm_options) { | 208 CommandLineOptions* vm_options) { |
| 222 ASSERT(arg != NULL); | 209 ASSERT(arg != NULL); |
| 223 if (*arg == '-') { | 210 if (*arg == '-') { |
| 224 return false; | 211 return false; |
| 225 } | 212 } |
| 226 save_compilation_trace_filename = arg; | 213 save_compilation_trace_filename = arg; |
| 227 return true; | 214 return true; |
| 228 } | 215 } |
| 229 | 216 |
| 230 | |
| 231 static bool ProcessLoadCompilationTraceOption(const char* arg, | 217 static bool ProcessLoadCompilationTraceOption(const char* arg, |
| 232 CommandLineOptions* vm_options) { | 218 CommandLineOptions* vm_options) { |
| 233 ASSERT(arg != NULL); | 219 ASSERT(arg != NULL); |
| 234 if (*arg == '-') { | 220 if (*arg == '-') { |
| 235 return false; | 221 return false; |
| 236 } | 222 } |
| 237 load_compilation_trace_filename = arg; | 223 load_compilation_trace_filename = arg; |
| 238 return true; | 224 return true; |
| 239 } | 225 } |
| 240 | 226 |
| 241 | |
| 242 static bool ProcessSaveFeedbackOption(const char* arg, | 227 static bool ProcessSaveFeedbackOption(const char* arg, |
| 243 CommandLineOptions* vm_options) { | 228 CommandLineOptions* vm_options) { |
| 244 ASSERT(arg != NULL); | 229 ASSERT(arg != NULL); |
| 245 if (*arg == '-') { | 230 if (*arg == '-') { |
| 246 return false; | 231 return false; |
| 247 } | 232 } |
| 248 save_feedback_filename = arg; | 233 save_feedback_filename = arg; |
| 249 return true; | 234 return true; |
| 250 } | 235 } |
| 251 | 236 |
| 252 | |
| 253 static bool ProcessLoadFeedbackOption(const char* arg, | 237 static bool ProcessLoadFeedbackOption(const char* arg, |
| 254 CommandLineOptions* vm_options) { | 238 CommandLineOptions* vm_options) { |
| 255 ASSERT(arg != NULL); | 239 ASSERT(arg != NULL); |
| 256 if (*arg == '-') { | 240 if (*arg == '-') { |
| 257 return false; | 241 return false; |
| 258 } | 242 } |
| 259 load_feedback_filename = arg; | 243 load_feedback_filename = arg; |
| 260 return true; | 244 return true; |
| 261 } | 245 } |
| 262 | 246 |
| 263 | |
| 264 static void* GetHashmapKeyFromString(char* key) { | 247 static void* GetHashmapKeyFromString(char* key) { |
| 265 return reinterpret_cast<void*>(key); | 248 return reinterpret_cast<void*>(key); |
| 266 } | 249 } |
| 267 | 250 |
| 268 | |
| 269 static bool ExtractPortAndAddress(const char* option_value, | 251 static bool ExtractPortAndAddress(const char* option_value, |
| 270 int* out_port, | 252 int* out_port, |
| 271 const char** out_ip, | 253 const char** out_ip, |
| 272 int default_port, | 254 int default_port, |
| 273 const char* default_ip) { | 255 const char* default_ip) { |
| 274 // [option_value] has to be one of the following formats: | 256 // [option_value] has to be one of the following formats: |
| 275 // - "" | 257 // - "" |
| 276 // - ":8181" | 258 // - ":8181" |
| 277 // - "=8181" | 259 // - "=8181" |
| 278 // - ":8181/192.168.0.1" | 260 // - ":8181/192.168.0.1" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 295 *out_ip = default_ip; | 277 *out_ip = default_ip; |
| 296 *out_port = port; | 278 *out_port = port; |
| 297 return true; | 279 return true; |
| 298 } | 280 } |
| 299 | 281 |
| 300 *out_ip = slash + 1; | 282 *out_ip = slash + 1; |
| 301 *out_port = port; | 283 *out_port = port; |
| 302 return true; | 284 return true; |
| 303 } | 285 } |
| 304 | 286 |
| 305 | |
| 306 static bool ProcessEnvironmentOption(const char* arg, | 287 static bool ProcessEnvironmentOption(const char* arg, |
| 307 CommandLineOptions* vm_options) { | 288 CommandLineOptions* vm_options) { |
| 308 ASSERT(arg != NULL); | 289 ASSERT(arg != NULL); |
| 309 if (*arg == '\0') { | 290 if (*arg == '\0') { |
| 310 // Ignore empty -D option. | 291 // Ignore empty -D option. |
| 311 Log::PrintErr("No arguments given to -D option, ignoring it\n"); | 292 Log::PrintErr("No arguments given to -D option, ignoring it\n"); |
| 312 return true; | 293 return true; |
| 313 } | 294 } |
| 314 // Split the name=value part of the -Dname=value argument. | 295 // Split the name=value part of the -Dname=value argument. |
| 315 const char* equals_pos = strchr(arg, '='); | 296 const char* equals_pos = strchr(arg, '='); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 338 HashMap::StringHash(name), true); | 319 HashMap::StringHash(name), true); |
| 339 ASSERT(entry != NULL); // Lookup adds an entry if key not found. | 320 ASSERT(entry != NULL); // Lookup adds an entry if key not found. |
| 340 if (entry->value != NULL) { | 321 if (entry->value != NULL) { |
| 341 free(name); | 322 free(name); |
| 342 free(entry->value); | 323 free(entry->value); |
| 343 } | 324 } |
| 344 entry->value = value; | 325 entry->value = value; |
| 345 return true; | 326 return true; |
| 346 } | 327 } |
| 347 | 328 |
| 348 | |
| 349 static bool ProcessCompileAllOption(const char* arg, | 329 static bool ProcessCompileAllOption(const char* arg, |
| 350 CommandLineOptions* vm_options) { | 330 CommandLineOptions* vm_options) { |
| 351 ASSERT(arg != NULL); | 331 ASSERT(arg != NULL); |
| 352 if (*arg != '\0') { | 332 if (*arg != '\0') { |
| 353 return false; | 333 return false; |
| 354 } | 334 } |
| 355 compile_all = true; | 335 compile_all = true; |
| 356 return true; | 336 return true; |
| 357 } | 337 } |
| 358 | 338 |
| 359 | |
| 360 static bool ProcessParseAllOption(const char* arg, | 339 static bool ProcessParseAllOption(const char* arg, |
| 361 CommandLineOptions* vm_options) { | 340 CommandLineOptions* vm_options) { |
| 362 ASSERT(arg != NULL); | 341 ASSERT(arg != NULL); |
| 363 if (*arg != '\0') { | 342 if (*arg != '\0') { |
| 364 return false; | 343 return false; |
| 365 } | 344 } |
| 366 parse_all = true; | 345 parse_all = true; |
| 367 return true; | 346 return true; |
| 368 } | 347 } |
| 369 | 348 |
| 370 | |
| 371 #if !defined(DART_PRECOMPILED_RUNTIME) | 349 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 372 static bool ProcessFrontendOption(const char* filename, | 350 static bool ProcessFrontendOption(const char* filename, |
| 373 CommandLineOptions* vm_options) { | 351 CommandLineOptions* vm_options) { |
| 374 ASSERT(filename != NULL); | 352 ASSERT(filename != NULL); |
| 375 if (filename[0] == '\0') { | 353 if (filename[0] == '\0') { |
| 376 return false; | 354 return false; |
| 377 } | 355 } |
| 378 dfe.set_frontend_filename(filename); | 356 dfe.set_frontend_filename(filename); |
| 379 vm_options->AddArgument("--use-dart-frontend"); | 357 vm_options->AddArgument("--use-dart-frontend"); |
| 380 return true; | 358 return true; |
| 381 } | 359 } |
| 382 | 360 |
| 383 | |
| 384 static bool ProcessKernelBinariesOption(const char* dirname, | 361 static bool ProcessKernelBinariesOption(const char* dirname, |
| 385 CommandLineOptions* vm_options) { | 362 CommandLineOptions* vm_options) { |
| 386 ASSERT(dirname != NULL); | 363 ASSERT(dirname != NULL); |
| 387 if (dirname[0] == '\0') { | 364 if (dirname[0] == '\0') { |
| 388 return false; | 365 return false; |
| 389 } | 366 } |
| 390 dfe.SetKernelBinaries(dirname); | 367 dfe.SetKernelBinaries(dirname); |
| 391 return true; | 368 return true; |
| 392 } | 369 } |
| 393 #endif | 370 #endif |
| 394 | 371 |
| 395 | |
| 396 static bool ProcessUseBlobsOption(const char* arg, | 372 static bool ProcessUseBlobsOption(const char* arg, |
| 397 CommandLineOptions* vm_options) { | 373 CommandLineOptions* vm_options) { |
| 398 ASSERT(arg != NULL); | 374 ASSERT(arg != NULL); |
| 399 if (*arg != '\0') { | 375 if (*arg != '\0') { |
| 400 return false; | 376 return false; |
| 401 } | 377 } |
| 402 use_blobs = true; | 378 use_blobs = true; |
| 403 return true; | 379 return true; |
| 404 } | 380 } |
| 405 | 381 |
| 406 | |
| 407 static bool ProcessSnapshotFilenameOption(const char* filename, | 382 static bool ProcessSnapshotFilenameOption(const char* filename, |
| 408 CommandLineOptions* vm_options) { | 383 CommandLineOptions* vm_options) { |
| 409 snapshot_filename = filename; | 384 snapshot_filename = filename; |
| 410 if (gen_snapshot_kind == kNone) { | 385 if (gen_snapshot_kind == kNone) { |
| 411 gen_snapshot_kind = kScript; // Default behavior. | 386 gen_snapshot_kind = kScript; // Default behavior. |
| 412 } | 387 } |
| 413 return true; | 388 return true; |
| 414 } | 389 } |
| 415 | 390 |
| 416 | |
| 417 static bool ProcessSnapshotKindOption(const char* kind, | 391 static bool ProcessSnapshotKindOption(const char* kind, |
| 418 CommandLineOptions* vm_options) { | 392 CommandLineOptions* vm_options) { |
| 419 if (strcmp(kind, "script") == 0) { | 393 if (strcmp(kind, "script") == 0) { |
| 420 gen_snapshot_kind = kScript; | 394 gen_snapshot_kind = kScript; |
| 421 return true; | 395 return true; |
| 422 } else if (strcmp(kind, "app-aot") == 0) { | 396 } else if (strcmp(kind, "app-aot") == 0) { |
| 423 gen_snapshot_kind = kAppAOT; | 397 gen_snapshot_kind = kAppAOT; |
| 424 return true; | 398 return true; |
| 425 } else if (strcmp(kind, "app-jit") == 0) { | 399 } else if (strcmp(kind, "app-jit") == 0) { |
| 426 gen_snapshot_kind = kAppJIT; | 400 gen_snapshot_kind = kAppJIT; |
| 427 return true; | 401 return true; |
| 428 } | 402 } |
| 429 Log::PrintErr( | 403 Log::PrintErr( |
| 430 "Unrecognized snapshot kind: '%s'\nValid kinds are: " | 404 "Unrecognized snapshot kind: '%s'\nValid kinds are: " |
| 431 "script, app-aot, app-jit\n", | 405 "script, app-aot, app-jit\n", |
| 432 kind); | 406 kind); |
| 433 return false; | 407 return false; |
| 434 } | 408 } |
| 435 | 409 |
| 436 | |
| 437 static bool ProcessSnapshotDepsFilenameOption(const char* filename, | 410 static bool ProcessSnapshotDepsFilenameOption(const char* filename, |
| 438 CommandLineOptions* vm_options) { | 411 CommandLineOptions* vm_options) { |
| 439 snapshot_deps_filename = filename; | 412 snapshot_deps_filename = filename; |
| 440 return true; | 413 return true; |
| 441 } | 414 } |
| 442 | 415 |
| 443 | |
| 444 static bool ProcessEnableVmServiceOption(const char* option_value, | 416 static bool ProcessEnableVmServiceOption(const char* option_value, |
| 445 CommandLineOptions* vm_options) { | 417 CommandLineOptions* vm_options) { |
| 446 ASSERT(option_value != NULL); | 418 ASSERT(option_value != NULL); |
| 447 | 419 |
| 448 if (!ExtractPortAndAddress( | 420 if (!ExtractPortAndAddress( |
| 449 option_value, &vm_service_server_port, &vm_service_server_ip, | 421 option_value, &vm_service_server_port, &vm_service_server_ip, |
| 450 DEFAULT_VM_SERVICE_SERVER_PORT, DEFAULT_VM_SERVICE_SERVER_IP)) { | 422 DEFAULT_VM_SERVICE_SERVER_PORT, DEFAULT_VM_SERVICE_SERVER_IP)) { |
| 451 Log::PrintErr( | 423 Log::PrintErr( |
| 452 "unrecognized --enable-vm-service option syntax. " | 424 "unrecognized --enable-vm-service option syntax. " |
| 453 "Use --enable-vm-service[=<port number>[/<bind address>]]\n"); | 425 "Use --enable-vm-service[=<port number>[/<bind address>]]\n"); |
| 454 return false; | 426 return false; |
| 455 } | 427 } |
| 456 | 428 |
| 457 return true; | 429 return true; |
| 458 } | 430 } |
| 459 | 431 |
| 460 | |
| 461 static bool ProcessDisableServiceOriginCheckOption( | 432 static bool ProcessDisableServiceOriginCheckOption( |
| 462 const char* option_value, | 433 const char* option_value, |
| 463 CommandLineOptions* vm_options) { | 434 CommandLineOptions* vm_options) { |
| 464 ASSERT(option_value != NULL); | 435 ASSERT(option_value != NULL); |
| 465 Log::PrintErr( | 436 Log::PrintErr( |
| 466 "WARNING: You are running with the service protocol in an " | 437 "WARNING: You are running with the service protocol in an " |
| 467 "insecure mode.\n"); | 438 "insecure mode.\n"); |
| 468 vm_service_dev_mode = true; | 439 vm_service_dev_mode = true; |
| 469 return true; | 440 return true; |
| 470 } | 441 } |
| 471 | 442 |
| 472 | |
| 473 static bool ProcessObserveOption(const char* option_value, | 443 static bool ProcessObserveOption(const char* option_value, |
| 474 CommandLineOptions* vm_options) { | 444 CommandLineOptions* vm_options) { |
| 475 ASSERT(option_value != NULL); | 445 ASSERT(option_value != NULL); |
| 476 | 446 |
| 477 if (!ExtractPortAndAddress( | 447 if (!ExtractPortAndAddress( |
| 478 option_value, &vm_service_server_port, &vm_service_server_ip, | 448 option_value, &vm_service_server_port, &vm_service_server_ip, |
| 479 DEFAULT_VM_SERVICE_SERVER_PORT, DEFAULT_VM_SERVICE_SERVER_IP)) { | 449 DEFAULT_VM_SERVICE_SERVER_PORT, DEFAULT_VM_SERVICE_SERVER_IP)) { |
| 480 Log::PrintErr( | 450 Log::PrintErr( |
| 481 "unrecognized --observe option syntax. " | 451 "unrecognized --observe option syntax. " |
| 482 "Use --observe[=<port number>[/<bind address>]]\n"); | 452 "Use --observe[=<port number>[/<bind address>]]\n"); |
| 483 return false; | 453 return false; |
| 484 } | 454 } |
| 485 | 455 |
| 486 // These options should also be documented in the help message. | 456 // These options should also be documented in the help message. |
| 487 vm_options->AddArgument("--pause-isolates-on-exit"); | 457 vm_options->AddArgument("--pause-isolates-on-exit"); |
| 488 vm_options->AddArgument("--pause-isolates-on-unhandled-exceptions"); | 458 vm_options->AddArgument("--pause-isolates-on-unhandled-exceptions"); |
| 489 vm_options->AddArgument("--warn-on-pause-with-no-debugger"); | 459 vm_options->AddArgument("--warn-on-pause-with-no-debugger"); |
| 490 return true; | 460 return true; |
| 491 } | 461 } |
| 492 | 462 |
| 493 | |
| 494 static bool ProcessTraceLoadingOption(const char* arg, | 463 static bool ProcessTraceLoadingOption(const char* arg, |
| 495 CommandLineOptions* vm_options) { | 464 CommandLineOptions* vm_options) { |
| 496 if (*arg != '\0') { | 465 if (*arg != '\0') { |
| 497 return false; | 466 return false; |
| 498 } | 467 } |
| 499 trace_loading = true; | 468 trace_loading = true; |
| 500 return true; | 469 return true; |
| 501 } | 470 } |
| 502 | 471 |
| 503 | |
| 504 static bool ProcessHotReloadTestModeOption(const char* arg, | 472 static bool ProcessHotReloadTestModeOption(const char* arg, |
| 505 CommandLineOptions* vm_options) { | 473 CommandLineOptions* vm_options) { |
| 506 if (*arg != '\0') { | 474 if (*arg != '\0') { |
| 507 return false; | 475 return false; |
| 508 } | 476 } |
| 509 | 477 |
| 510 // Identity reload. | 478 // Identity reload. |
| 511 vm_options->AddArgument("--identity_reload"); | 479 vm_options->AddArgument("--identity_reload"); |
| 512 // Start reloading quickly. | 480 // Start reloading quickly. |
| 513 vm_options->AddArgument("--reload_every=4"); | 481 vm_options->AddArgument("--reload_every=4"); |
| 514 // Reload from optimized and unoptimized code. | 482 // Reload from optimized and unoptimized code. |
| 515 vm_options->AddArgument("--reload_every_optimized=false"); | 483 vm_options->AddArgument("--reload_every_optimized=false"); |
| 516 // Reload less frequently as time goes on. | 484 // Reload less frequently as time goes on. |
| 517 vm_options->AddArgument("--reload_every_back_off"); | 485 vm_options->AddArgument("--reload_every_back_off"); |
| 518 // Ensure that every isolate has reloaded once before exiting. | 486 // Ensure that every isolate has reloaded once before exiting. |
| 519 vm_options->AddArgument("--check_reloaded"); | 487 vm_options->AddArgument("--check_reloaded"); |
| 520 | 488 |
| 521 return true; | 489 return true; |
| 522 } | 490 } |
| 523 | 491 |
| 524 | |
| 525 static bool ProcessHotReloadRollbackTestModeOption( | 492 static bool ProcessHotReloadRollbackTestModeOption( |
| 526 const char* arg, | 493 const char* arg, |
| 527 CommandLineOptions* vm_options) { | 494 CommandLineOptions* vm_options) { |
| 528 // Identity reload. | 495 // Identity reload. |
| 529 vm_options->AddArgument("--identity_reload"); | 496 vm_options->AddArgument("--identity_reload"); |
| 530 // Start reloading quickly. | 497 // Start reloading quickly. |
| 531 vm_options->AddArgument("--reload_every=4"); | 498 vm_options->AddArgument("--reload_every=4"); |
| 532 // Reload from optimized and unoptimized code. | 499 // Reload from optimized and unoptimized code. |
| 533 vm_options->AddArgument("--reload_every_optimized=false"); | 500 vm_options->AddArgument("--reload_every_optimized=false"); |
| 534 // Reload less frequently as time goes on. | 501 // Reload less frequently as time goes on. |
| 535 vm_options->AddArgument("--reload_every_back_off"); | 502 vm_options->AddArgument("--reload_every_back_off"); |
| 536 // Ensure that every isolate has reloaded once before exiting. | 503 // Ensure that every isolate has reloaded once before exiting. |
| 537 vm_options->AddArgument("--check_reloaded"); | 504 vm_options->AddArgument("--check_reloaded"); |
| 538 // Force all reloads to fail and execute the rollback code. | 505 // Force all reloads to fail and execute the rollback code. |
| 539 vm_options->AddArgument("--reload_force_rollback"); | 506 vm_options->AddArgument("--reload_force_rollback"); |
| 540 | 507 |
| 541 return true; | 508 return true; |
| 542 } | 509 } |
| 543 | 510 |
| 544 | |
| 545 extern bool short_socket_read; | 511 extern bool short_socket_read; |
| 546 | 512 |
| 547 extern bool short_socket_write; | 513 extern bool short_socket_write; |
| 548 | 514 |
| 549 static bool ProcessShortSocketReadOption(const char* arg, | 515 static bool ProcessShortSocketReadOption(const char* arg, |
| 550 CommandLineOptions* vm_options) { | 516 CommandLineOptions* vm_options) { |
| 551 short_socket_read = true; | 517 short_socket_read = true; |
| 552 return true; | 518 return true; |
| 553 } | 519 } |
| 554 | 520 |
| 555 | |
| 556 static bool ProcessShortSocketWriteOption(const char* arg, | 521 static bool ProcessShortSocketWriteOption(const char* arg, |
| 557 CommandLineOptions* vm_options) { | 522 CommandLineOptions* vm_options) { |
| 558 short_socket_write = true; | 523 short_socket_write = true; |
| 559 return true; | 524 return true; |
| 560 } | 525 } |
| 561 | 526 |
| 562 | |
| 563 extern const char* commandline_root_certs_file; | 527 extern const char* commandline_root_certs_file; |
| 564 extern const char* commandline_root_certs_cache; | 528 extern const char* commandline_root_certs_cache; |
| 565 | 529 |
| 566 static bool ProcessRootCertsFileOption(const char* arg, | 530 static bool ProcessRootCertsFileOption(const char* arg, |
| 567 CommandLineOptions* vm_options) { | 531 CommandLineOptions* vm_options) { |
| 568 ASSERT(arg != NULL); | 532 ASSERT(arg != NULL); |
| 569 if (*arg == '-') { | 533 if (*arg == '-') { |
| 570 return false; | 534 return false; |
| 571 } | 535 } |
| 572 if (commandline_root_certs_cache != NULL) { | 536 if (commandline_root_certs_cache != NULL) { |
| 573 Log::PrintErr( | 537 Log::PrintErr( |
| 574 "Only one of --root-certs-file and --root-certs-cache " | 538 "Only one of --root-certs-file and --root-certs-cache " |
| 575 "may be specified"); | 539 "may be specified"); |
| 576 return false; | 540 return false; |
| 577 } | 541 } |
| 578 commandline_root_certs_file = arg; | 542 commandline_root_certs_file = arg; |
| 579 return true; | 543 return true; |
| 580 } | 544 } |
| 581 | 545 |
| 582 | |
| 583 static bool ProcessRootCertsCacheOption(const char* arg, | 546 static bool ProcessRootCertsCacheOption(const char* arg, |
| 584 CommandLineOptions* vm_options) { | 547 CommandLineOptions* vm_options) { |
| 585 ASSERT(arg != NULL); | 548 ASSERT(arg != NULL); |
| 586 if (*arg == '-') { | 549 if (*arg == '-') { |
| 587 return false; | 550 return false; |
| 588 } | 551 } |
| 589 if (commandline_root_certs_file != NULL) { | 552 if (commandline_root_certs_file != NULL) { |
| 590 Log::PrintErr( | 553 Log::PrintErr( |
| 591 "Only one of --root-certs-file and --root-certs-cache " | 554 "Only one of --root-certs-file and --root-certs-cache " |
| 592 "may be specified"); | 555 "may be specified"); |
| 593 return false; | 556 return false; |
| 594 } | 557 } |
| 595 commandline_root_certs_cache = arg; | 558 commandline_root_certs_cache = arg; |
| 596 return true; | 559 return true; |
| 597 } | 560 } |
| 598 | 561 |
| 599 | |
| 600 static struct { | 562 static struct { |
| 601 const char* option_name; | 563 const char* option_name; |
| 602 bool (*process)(const char* option, CommandLineOptions* vm_options); | 564 bool (*process)(const char* option, CommandLineOptions* vm_options); |
| 603 } main_options[] = { | 565 } main_options[] = { |
| 604 // Standard options shared with dart2js. | 566 // Standard options shared with dart2js. |
| 605 {"-D", ProcessEnvironmentOption}, | 567 {"-D", ProcessEnvironmentOption}, |
| 606 {"-h", ProcessHelpOption}, | 568 {"-h", ProcessHelpOption}, |
| 607 {"--help", ProcessHelpOption}, | 569 {"--help", ProcessHelpOption}, |
| 608 {"--packages=", ProcessPackagesOption}, | 570 {"--packages=", ProcessPackagesOption}, |
| 609 {"--package-root=", ProcessPackageRootOption}, | 571 {"--package-root=", ProcessPackageRootOption}, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 631 {"--load-feedback=", ProcessLoadFeedbackOption}, | 593 {"--load-feedback=", ProcessLoadFeedbackOption}, |
| 632 {"--trace-loading", ProcessTraceLoadingOption}, | 594 {"--trace-loading", ProcessTraceLoadingOption}, |
| 633 {"--hot-reload-test-mode", ProcessHotReloadTestModeOption}, | 595 {"--hot-reload-test-mode", ProcessHotReloadTestModeOption}, |
| 634 {"--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption}, | 596 {"--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption}, |
| 635 {"--short_socket_read", ProcessShortSocketReadOption}, | 597 {"--short_socket_read", ProcessShortSocketReadOption}, |
| 636 {"--short_socket_write", ProcessShortSocketWriteOption}, | 598 {"--short_socket_write", ProcessShortSocketWriteOption}, |
| 637 {"--root-certs-file=", ProcessRootCertsFileOption}, | 599 {"--root-certs-file=", ProcessRootCertsFileOption}, |
| 638 {"--root-certs-cache=", ProcessRootCertsCacheOption}, | 600 {"--root-certs-cache=", ProcessRootCertsCacheOption}, |
| 639 {NULL, NULL}}; | 601 {NULL, NULL}}; |
| 640 | 602 |
| 641 | |
| 642 static bool ProcessMainOptions(const char* option, | 603 static bool ProcessMainOptions(const char* option, |
| 643 CommandLineOptions* vm_options) { | 604 CommandLineOptions* vm_options) { |
| 644 int i = 0; | 605 int i = 0; |
| 645 const char* name = main_options[0].option_name; | 606 const char* name = main_options[0].option_name; |
| 646 int option_length = strlen(option); | 607 int option_length = strlen(option); |
| 647 while (name != NULL) { | 608 while (name != NULL) { |
| 648 int length = strlen(name); | 609 int length = strlen(name); |
| 649 if ((option_length >= length) && (strncmp(option, name, length) == 0)) { | 610 if ((option_length >= length) && (strncmp(option, name, length) == 0)) { |
| 650 if (main_options[i].process(option + length, vm_options)) { | 611 if (main_options[i].process(option + length, vm_options)) { |
| 651 return true; | 612 return true; |
| 652 } | 613 } |
| 653 } | 614 } |
| 654 i += 1; | 615 i += 1; |
| 655 name = main_options[i].option_name; | 616 name = main_options[i].option_name; |
| 656 } | 617 } |
| 657 return false; | 618 return false; |
| 658 } | 619 } |
| 659 | 620 |
| 660 | |
| 661 // Parse out the command line arguments. Returns -1 if the arguments | 621 // Parse out the command line arguments. Returns -1 if the arguments |
| 662 // are incorrect, 0 otherwise. | 622 // are incorrect, 0 otherwise. |
| 663 static int ParseArguments(int argc, | 623 static int ParseArguments(int argc, |
| 664 char** argv, | 624 char** argv, |
| 665 CommandLineOptions* vm_options, | 625 CommandLineOptions* vm_options, |
| 666 char** script_name, | 626 char** script_name, |
| 667 CommandLineOptions* dart_options, | 627 CommandLineOptions* dart_options, |
| 668 bool* print_flags_seen, | 628 bool* print_flags_seen, |
| 669 bool* verbose_debug_seen) { | 629 bool* verbose_debug_seen) { |
| 670 const char* kPrefix = "--"; | 630 const char* kPrefix = "--"; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 if ((gen_snapshot_kind != kNone) && vm_run_app_snapshot) { | 727 if ((gen_snapshot_kind != kNone) && vm_run_app_snapshot) { |
| 768 Log::PrintErr( | 728 Log::PrintErr( |
| 769 "Specifying an option to generate a snapshot and" | 729 "Specifying an option to generate a snapshot and" |
| 770 " run using a snapshot is invalid.\n"); | 730 " run using a snapshot is invalid.\n"); |
| 771 return -1; | 731 return -1; |
| 772 } | 732 } |
| 773 | 733 |
| 774 return 0; | 734 return 0; |
| 775 } | 735 } |
| 776 | 736 |
| 777 | |
| 778 static Dart_Handle CreateRuntimeOptions(CommandLineOptions* options) { | 737 static Dart_Handle CreateRuntimeOptions(CommandLineOptions* options) { |
| 779 int options_count = options->count(); | 738 int options_count = options->count(); |
| 780 Dart_Handle dart_arguments = Dart_NewList(options_count); | 739 Dart_Handle dart_arguments = Dart_NewList(options_count); |
| 781 if (Dart_IsError(dart_arguments)) { | 740 if (Dart_IsError(dart_arguments)) { |
| 782 return dart_arguments; | 741 return dart_arguments; |
| 783 } | 742 } |
| 784 for (int i = 0; i < options_count; i++) { | 743 for (int i = 0; i < options_count; i++) { |
| 785 Dart_Handle argument_value = DartUtils::NewString(options->GetArgument(i)); | 744 Dart_Handle argument_value = DartUtils::NewString(options->GetArgument(i)); |
| 786 if (Dart_IsError(argument_value)) { | 745 if (Dart_IsError(argument_value)) { |
| 787 return argument_value; | 746 return argument_value; |
| 788 } | 747 } |
| 789 Dart_Handle result = Dart_ListSetAt(dart_arguments, i, argument_value); | 748 Dart_Handle result = Dart_ListSetAt(dart_arguments, i, argument_value); |
| 790 if (Dart_IsError(result)) { | 749 if (Dart_IsError(result)) { |
| 791 return result; | 750 return result; |
| 792 } | 751 } |
| 793 } | 752 } |
| 794 return dart_arguments; | 753 return dart_arguments; |
| 795 } | 754 } |
| 796 | 755 |
| 797 | |
| 798 static Dart_Handle EnvironmentCallback(Dart_Handle name) { | 756 static Dart_Handle EnvironmentCallback(Dart_Handle name) { |
| 799 uint8_t* utf8_array; | 757 uint8_t* utf8_array; |
| 800 intptr_t utf8_len; | 758 intptr_t utf8_len; |
| 801 Dart_Handle result = Dart_Null(); | 759 Dart_Handle result = Dart_Null(); |
| 802 Dart_Handle handle = Dart_StringToUTF8(name, &utf8_array, &utf8_len); | 760 Dart_Handle handle = Dart_StringToUTF8(name, &utf8_array, &utf8_len); |
| 803 if (Dart_IsError(handle)) { | 761 if (Dart_IsError(handle)) { |
| 804 handle = Dart_ThrowException( | 762 handle = Dart_ThrowException( |
| 805 DartUtils::NewDartArgumentError(Dart_GetError(handle))); | 763 DartUtils::NewDartArgumentError(Dart_GetError(handle))); |
| 806 } else { | 764 } else { |
| 807 char* name_chars = reinterpret_cast<char*>(malloc(utf8_len + 1)); | 765 char* name_chars = reinterpret_cast<char*>(malloc(utf8_len + 1)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 818 } | 776 } |
| 819 if (value != NULL) { | 777 if (value != NULL) { |
| 820 result = Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(value), | 778 result = Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(value), |
| 821 strlen(value)); | 779 strlen(value)); |
| 822 } | 780 } |
| 823 free(name_chars); | 781 free(name_chars); |
| 824 } | 782 } |
| 825 return result; | 783 return result; |
| 826 } | 784 } |
| 827 | 785 |
| 828 | |
| 829 #define SAVE_ERROR_AND_EXIT(result) \ | 786 #define SAVE_ERROR_AND_EXIT(result) \ |
| 830 *error = strdup(Dart_GetError(result)); \ | 787 *error = strdup(Dart_GetError(result)); \ |
| 831 if (Dart_IsCompilationError(result)) { \ | 788 if (Dart_IsCompilationError(result)) { \ |
| 832 *exit_code = kCompilationErrorExitCode; \ | 789 *exit_code = kCompilationErrorExitCode; \ |
| 833 } else if (Dart_IsApiError(result)) { \ | 790 } else if (Dart_IsApiError(result)) { \ |
| 834 *exit_code = kApiErrorExitCode; \ | 791 *exit_code = kApiErrorExitCode; \ |
| 835 } else { \ | 792 } else { \ |
| 836 *exit_code = kErrorExitCode; \ | 793 *exit_code = kErrorExitCode; \ |
| 837 } \ | 794 } \ |
| 838 Dart_ExitScope(); \ | 795 Dart_ExitScope(); \ |
| 839 Dart_ShutdownIsolate(); \ | 796 Dart_ShutdownIsolate(); \ |
| 840 return NULL; | 797 return NULL; |
| 841 | 798 |
| 842 | |
| 843 #define CHECK_RESULT(result) \ | 799 #define CHECK_RESULT(result) \ |
| 844 if (Dart_IsError(result)) { \ | 800 if (Dart_IsError(result)) { \ |
| 845 SAVE_ERROR_AND_EXIT(result); \ | 801 SAVE_ERROR_AND_EXIT(result); \ |
| 846 } | 802 } |
| 847 | 803 |
| 848 | |
| 849 #define CHECK_RESULT_CLEANUP(result, cleanup) \ | 804 #define CHECK_RESULT_CLEANUP(result, cleanup) \ |
| 850 if (Dart_IsError(result)) { \ | 805 if (Dart_IsError(result)) { \ |
| 851 delete (cleanup); \ | 806 delete (cleanup); \ |
| 852 SAVE_ERROR_AND_EXIT(result); \ | 807 SAVE_ERROR_AND_EXIT(result); \ |
| 853 } | 808 } |
| 854 | 809 |
| 855 | |
| 856 static void SnapshotOnExitHook(int64_t exit_code) { | 810 static void SnapshotOnExitHook(int64_t exit_code) { |
| 857 if (Dart_CurrentIsolate() != main_isolate) { | 811 if (Dart_CurrentIsolate() != main_isolate) { |
| 858 Log::PrintErr( | 812 Log::PrintErr( |
| 859 "A snapshot was requested, but a secondary isolate " | 813 "A snapshot was requested, but a secondary isolate " |
| 860 "performed a hard exit (%" Pd64 ").\n", | 814 "performed a hard exit (%" Pd64 ").\n", |
| 861 exit_code); | 815 exit_code); |
| 862 Platform::Exit(kErrorExitCode); | 816 Platform::Exit(kErrorExitCode); |
| 863 } | 817 } |
| 864 if (exit_code == 0) { | 818 if (exit_code == 0) { |
| 865 Snapshot::GenerateAppJIT(snapshot_filename); | 819 Snapshot::GenerateAppJIT(snapshot_filename); |
| 866 } | 820 } |
| 867 } | 821 } |
| 868 | 822 |
| 869 | |
| 870 static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, | 823 static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, |
| 871 bool is_main_isolate, | 824 bool is_main_isolate, |
| 872 const char* script_uri, | 825 const char* script_uri, |
| 873 const char* package_root, | 826 const char* package_root, |
| 874 const char* packages_config, | 827 const char* packages_config, |
| 875 bool set_native_resolvers, | 828 bool set_native_resolvers, |
| 876 bool isolate_run_app_snapshot, | 829 bool isolate_run_app_snapshot, |
| 877 char** error, | 830 char** error, |
| 878 int* exit_code) { | 831 int* exit_code) { |
| 879 Dart_EnterScope(); | 832 Dart_EnterScope(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 if (!retval) { | 918 if (!retval) { |
| 966 *error = strdup("Invalid isolate state - Unable to make it runnable"); | 919 *error = strdup("Invalid isolate state - Unable to make it runnable"); |
| 967 Dart_EnterIsolate(isolate); | 920 Dart_EnterIsolate(isolate); |
| 968 Dart_ShutdownIsolate(); | 921 Dart_ShutdownIsolate(); |
| 969 return NULL; | 922 return NULL; |
| 970 } | 923 } |
| 971 | 924 |
| 972 return isolate; | 925 return isolate; |
| 973 } | 926 } |
| 974 | 927 |
| 975 | |
| 976 #if !defined(DART_PRECOMPILED_RUNTIME) | 928 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 977 // Returns newly created Kernel Isolate on success, NULL on failure. | 929 // Returns newly created Kernel Isolate on success, NULL on failure. |
| 978 // For now we only support the kernel isolate coming up from an | 930 // For now we only support the kernel isolate coming up from an |
| 979 // application snapshot or from sources which are compiled by the | 931 // application snapshot or from sources which are compiled by the |
| 980 // VM parser. | 932 // VM parser. |
| 981 static Dart_Isolate CreateAndSetupKernelIsolate(const char* main, | 933 static Dart_Isolate CreateAndSetupKernelIsolate(const char* main, |
| 982 const char* package_root, | 934 const char* package_root, |
| 983 const char* packages_config, | 935 const char* packages_config, |
| 984 Dart_IsolateFlags* flags, | 936 Dart_IsolateFlags* flags, |
| 985 char** error, | 937 char** error, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 delete isolate_data; | 969 delete isolate_data; |
| 1018 return NULL; | 970 return NULL; |
| 1019 } | 971 } |
| 1020 | 972 |
| 1021 return IsolateSetupHelper(isolate, false, script_uri, package_root, | 973 return IsolateSetupHelper(isolate, false, script_uri, package_root, |
| 1022 packages_config, isolate_snapshot_data, | 974 packages_config, isolate_snapshot_data, |
| 1023 isolate_run_app_snapshot, error, exit_code); | 975 isolate_run_app_snapshot, error, exit_code); |
| 1024 } | 976 } |
| 1025 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 977 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1026 | 978 |
| 1027 | |
| 1028 // Returns newly created Service Isolate on success, NULL on failure. | 979 // Returns newly created Service Isolate on success, NULL on failure. |
| 1029 // For now we only support the service isolate coming up from sources | 980 // For now we only support the service isolate coming up from sources |
| 1030 // which are compiled by the VM parser. | 981 // which are compiled by the VM parser. |
| 1031 static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri, | 982 static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri, |
| 1032 const char* main, | 983 const char* main, |
| 1033 const char* package_root, | 984 const char* package_root, |
| 1034 const char* packages_config, | 985 const char* packages_config, |
| 1035 Dart_IsolateFlags* flags, | 986 Dart_IsolateFlags* flags, |
| 1036 char** error, | 987 char** error, |
| 1037 int* exit_code) { | 988 int* exit_code) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 result = Dart_CompileAll(); | 1048 result = Dart_CompileAll(); |
| 1098 CHECK_RESULT(result); | 1049 CHECK_RESULT(result); |
| 1099 } | 1050 } |
| 1100 result = Dart_SetEnvironmentCallback(EnvironmentCallback); | 1051 result = Dart_SetEnvironmentCallback(EnvironmentCallback); |
| 1101 CHECK_RESULT(result); | 1052 CHECK_RESULT(result); |
| 1102 Dart_ExitScope(); | 1053 Dart_ExitScope(); |
| 1103 Dart_ExitIsolate(); | 1054 Dart_ExitIsolate(); |
| 1104 return isolate; | 1055 return isolate; |
| 1105 } | 1056 } |
| 1106 | 1057 |
| 1107 | |
| 1108 // Returns newly created Isolate on success, NULL on failure. | 1058 // Returns newly created Isolate on success, NULL on failure. |
| 1109 static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate, | 1059 static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate, |
| 1110 const char* script_uri, | 1060 const char* script_uri, |
| 1111 const char* main, | 1061 const char* main, |
| 1112 const char* package_root, | 1062 const char* package_root, |
| 1113 const char* packages_config, | 1063 const char* packages_config, |
| 1114 Dart_IsolateFlags* flags, | 1064 Dart_IsolateFlags* flags, |
| 1115 char** error, | 1065 char** error, |
| 1116 int* exit_code) { | 1066 int* exit_code) { |
| 1117 ASSERT(script_uri != NULL); | 1067 ASSERT(script_uri != NULL); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 } | 1136 } |
| 1187 | 1137 |
| 1188 bool set_native_resolvers = (kernel_program || isolate_snapshot_data); | 1138 bool set_native_resolvers = (kernel_program || isolate_snapshot_data); |
| 1189 return IsolateSetupHelper(isolate, is_main_isolate, script_uri, package_root, | 1139 return IsolateSetupHelper(isolate, is_main_isolate, script_uri, package_root, |
| 1190 packages_config, set_native_resolvers, | 1140 packages_config, set_native_resolvers, |
| 1191 isolate_run_app_snapshot, error, exit_code); | 1141 isolate_run_app_snapshot, error, exit_code); |
| 1192 } | 1142 } |
| 1193 | 1143 |
| 1194 #undef CHECK_RESULT | 1144 #undef CHECK_RESULT |
| 1195 | 1145 |
| 1196 | |
| 1197 static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, | 1146 static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, |
| 1198 const char* main, | 1147 const char* main, |
| 1199 const char* package_root, | 1148 const char* package_root, |
| 1200 const char* package_config, | 1149 const char* package_config, |
| 1201 Dart_IsolateFlags* flags, | 1150 Dart_IsolateFlags* flags, |
| 1202 void* data, | 1151 void* data, |
| 1203 char** error) { | 1152 char** error) { |
| 1204 // The VM should never call the isolate helper with a NULL flags. | 1153 // The VM should never call the isolate helper with a NULL flags. |
| 1205 ASSERT(flags != NULL); | 1154 ASSERT(flags != NULL); |
| 1206 ASSERT(flags->version == DART_FLAGS_CURRENT_VERSION); | 1155 ASSERT(flags->version == DART_FLAGS_CURRENT_VERSION); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1222 return CreateAndSetupServiceIsolate(script_uri, main, package_root, | 1171 return CreateAndSetupServiceIsolate(script_uri, main, package_root, |
| 1223 package_config, flags, error, | 1172 package_config, flags, error, |
| 1224 &exit_code); | 1173 &exit_code); |
| 1225 } | 1174 } |
| 1226 bool is_main_isolate = false; | 1175 bool is_main_isolate = false; |
| 1227 return CreateIsolateAndSetupHelper(is_main_isolate, script_uri, main, | 1176 return CreateIsolateAndSetupHelper(is_main_isolate, script_uri, main, |
| 1228 package_root, package_config, flags, error, | 1177 package_root, package_config, flags, error, |
| 1229 &exit_code); | 1178 &exit_code); |
| 1230 } | 1179 } |
| 1231 | 1180 |
| 1232 | |
| 1233 static void PrintVersion() { | 1181 static void PrintVersion() { |
| 1234 Log::PrintErr("Dart VM version: %s\n", Dart_VersionString()); | 1182 Log::PrintErr("Dart VM version: %s\n", Dart_VersionString()); |
| 1235 } | 1183 } |
| 1236 | 1184 |
| 1237 | |
| 1238 // clang-format off | 1185 // clang-format off |
| 1239 static void PrintUsage() { | 1186 static void PrintUsage() { |
| 1240 Log::PrintErr( | 1187 Log::PrintErr( |
| 1241 "Usage: dart [<vm-flags>] <dart-script-file> [<dart-options>]\n" | 1188 "Usage: dart [<vm-flags>] <dart-script-file> [<dart-options>]\n" |
| 1242 "\n" | 1189 "\n" |
| 1243 "Executes the Dart script passed as <dart-script-file>.\n" | 1190 "Executes the Dart script passed as <dart-script-file>.\n" |
| 1244 "\n"); | 1191 "\n"); |
| 1245 if (!verbose_option) { | 1192 if (!verbose_option) { |
| 1246 Log::PrintErr( | 1193 Log::PrintErr( |
| 1247 "Common options:\n" | 1194 "Common options:\n" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 #endif // !defined(HOST_OS_MACOS) | 1269 #endif // !defined(HOST_OS_MACOS) |
| 1323 "\n" | 1270 "\n" |
| 1324 "The following options are only used for VM development and may\n" | 1271 "The following options are only used for VM development and may\n" |
| 1325 "be changed in any future version:\n"); | 1272 "be changed in any future version:\n"); |
| 1326 const char* print_flags = "--print_flags"; | 1273 const char* print_flags = "--print_flags"; |
| 1327 Dart_SetVMFlags(1, &print_flags); | 1274 Dart_SetVMFlags(1, &print_flags); |
| 1328 } | 1275 } |
| 1329 } | 1276 } |
| 1330 // clang-format on | 1277 // clang-format on |
| 1331 | 1278 |
| 1332 | |
| 1333 char* BuildIsolateName(const char* script_name, const char* func_name) { | 1279 char* BuildIsolateName(const char* script_name, const char* func_name) { |
| 1334 // Skip past any slashes in the script name. | 1280 // Skip past any slashes in the script name. |
| 1335 const char* last_slash = strrchr(script_name, '/'); | 1281 const char* last_slash = strrchr(script_name, '/'); |
| 1336 if (last_slash != NULL) { | 1282 if (last_slash != NULL) { |
| 1337 script_name = last_slash + 1; | 1283 script_name = last_slash + 1; |
| 1338 } | 1284 } |
| 1339 | 1285 |
| 1340 const char* kFormat = "%s/%s"; | 1286 const char* kFormat = "%s/%s"; |
| 1341 intptr_t len = strlen(script_name) + strlen(func_name) + 2; | 1287 intptr_t len = strlen(script_name) + strlen(func_name) + 2; |
| 1342 char* buffer = new char[len]; | 1288 char* buffer = new char[len]; |
| 1343 ASSERT(buffer != NULL); | 1289 ASSERT(buffer != NULL); |
| 1344 snprintf(buffer, len, kFormat, script_name, func_name); | 1290 snprintf(buffer, len, kFormat, script_name, func_name); |
| 1345 return buffer; | 1291 return buffer; |
| 1346 } | 1292 } |
| 1347 | 1293 |
| 1348 | |
| 1349 static void OnIsolateShutdown(void* callback_data) { | 1294 static void OnIsolateShutdown(void* callback_data) { |
| 1350 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); | 1295 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); |
| 1351 isolate_data->OnIsolateShutdown(); | 1296 isolate_data->OnIsolateShutdown(); |
| 1352 } | 1297 } |
| 1353 | 1298 |
| 1354 | |
| 1355 static void DeleteIsolateData(void* callback_data) { | 1299 static void DeleteIsolateData(void* callback_data) { |
| 1356 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); | 1300 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); |
| 1357 delete isolate_data; | 1301 delete isolate_data; |
| 1358 } | 1302 } |
| 1359 | 1303 |
| 1360 | |
| 1361 static const char* kStdoutStreamId = "Stdout"; | 1304 static const char* kStdoutStreamId = "Stdout"; |
| 1362 static const char* kStderrStreamId = "Stderr"; | 1305 static const char* kStderrStreamId = "Stderr"; |
| 1363 | 1306 |
| 1364 | |
| 1365 static bool ServiceStreamListenCallback(const char* stream_id) { | 1307 static bool ServiceStreamListenCallback(const char* stream_id) { |
| 1366 if (strcmp(stream_id, kStdoutStreamId) == 0) { | 1308 if (strcmp(stream_id, kStdoutStreamId) == 0) { |
| 1367 SetCaptureStdout(true); | 1309 SetCaptureStdout(true); |
| 1368 return true; | 1310 return true; |
| 1369 } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 1311 } else if (strcmp(stream_id, kStderrStreamId) == 0) { |
| 1370 SetCaptureStderr(true); | 1312 SetCaptureStderr(true); |
| 1371 return true; | 1313 return true; |
| 1372 } | 1314 } |
| 1373 return false; | 1315 return false; |
| 1374 } | 1316 } |
| 1375 | 1317 |
| 1376 | |
| 1377 static void ServiceStreamCancelCallback(const char* stream_id) { | 1318 static void ServiceStreamCancelCallback(const char* stream_id) { |
| 1378 if (strcmp(stream_id, kStdoutStreamId) == 0) { | 1319 if (strcmp(stream_id, kStdoutStreamId) == 0) { |
| 1379 SetCaptureStdout(false); | 1320 SetCaptureStdout(false); |
| 1380 } else if (strcmp(stream_id, kStderrStreamId) == 0) { | 1321 } else if (strcmp(stream_id, kStderrStreamId) == 0) { |
| 1381 SetCaptureStderr(false); | 1322 SetCaptureStderr(false); |
| 1382 } | 1323 } |
| 1383 } | 1324 } |
| 1384 | 1325 |
| 1385 | |
| 1386 static bool FileModifiedCallback(const char* url, int64_t since) { | 1326 static bool FileModifiedCallback(const char* url, int64_t since) { |
| 1387 if (strncmp(url, "file:///", 8) == 0) { | 1327 if (strncmp(url, "file:///", 8) == 0) { |
| 1388 // If it isn't a file on local disk, we don't know if it has been | 1328 // If it isn't a file on local disk, we don't know if it has been |
| 1389 // modified. | 1329 // modified. |
| 1390 return true; | 1330 return true; |
| 1391 } | 1331 } |
| 1392 int64_t data[File::kStatSize]; | 1332 int64_t data[File::kStatSize]; |
| 1393 File::Stat(url + 7, data); | 1333 File::Stat(url + 7, data); |
| 1394 if (data[File::kType] == File::kDoesNotExist) { | 1334 if (data[File::kType] == File::kDoesNotExist) { |
| 1395 return true; | 1335 return true; |
| 1396 } | 1336 } |
| 1397 bool modified = data[File::kModifiedTime] > since; | 1337 bool modified = data[File::kModifiedTime] > since; |
| 1398 return modified; | 1338 return modified; |
| 1399 } | 1339 } |
| 1400 | 1340 |
| 1401 | |
| 1402 static void GenerateAppAOTSnapshot() { | 1341 static void GenerateAppAOTSnapshot() { |
| 1403 if (use_blobs) { | 1342 if (use_blobs) { |
| 1404 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); | 1343 Snapshot::GenerateAppAOTAsBlobs(snapshot_filename); |
| 1405 } else { | 1344 } else { |
| 1406 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); | 1345 Snapshot::GenerateAppAOTAsAssembly(snapshot_filename); |
| 1407 } | 1346 } |
| 1408 } | 1347 } |
| 1409 | 1348 |
| 1410 | |
| 1411 #define CHECK_RESULT(result) \ | 1349 #define CHECK_RESULT(result) \ |
| 1412 if (Dart_IsError(result)) { \ | 1350 if (Dart_IsError(result)) { \ |
| 1413 const int exit_code = Dart_IsCompilationError(result) \ | 1351 const int exit_code = Dart_IsCompilationError(result) \ |
| 1414 ? kCompilationErrorExitCode \ | 1352 ? kCompilationErrorExitCode \ |
| 1415 : kErrorExitCode; \ | 1353 : kErrorExitCode; \ |
| 1416 ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \ | 1354 ErrorExit(exit_code, "%s\n", Dart_GetError(result)); \ |
| 1417 } | 1355 } |
| 1418 | 1356 |
| 1419 | |
| 1420 static void WriteFile(const char* filename, | 1357 static void WriteFile(const char* filename, |
| 1421 const uint8_t* buffer, | 1358 const uint8_t* buffer, |
| 1422 const intptr_t size) { | 1359 const intptr_t size) { |
| 1423 File* file = File::Open(filename, File::kWriteTruncate); | 1360 File* file = File::Open(filename, File::kWriteTruncate); |
| 1424 if (file == NULL) { | 1361 if (file == NULL) { |
| 1425 ErrorExit(kErrorExitCode, "Unable to open file %s\n", filename); | 1362 ErrorExit(kErrorExitCode, "Unable to open file %s\n", filename); |
| 1426 } | 1363 } |
| 1427 if (!file->WriteFully(buffer, size)) { | 1364 if (!file->WriteFully(buffer, size)) { |
| 1428 ErrorExit(kErrorExitCode, "Unable to write file %s\n", filename); | 1365 ErrorExit(kErrorExitCode, "Unable to write file %s\n", filename); |
| 1429 } | 1366 } |
| 1430 file->Release(); | 1367 file->Release(); |
| 1431 } | 1368 } |
| 1432 | 1369 |
| 1433 | |
| 1434 static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) { | 1370 static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) { |
| 1435 File* file = File::Open(filename, File::kRead); | 1371 File* file = File::Open(filename, File::kRead); |
| 1436 if (file == NULL) { | 1372 if (file == NULL) { |
| 1437 ErrorExit(kErrorExitCode, "Unable to open file %s\n", filename); | 1373 ErrorExit(kErrorExitCode, "Unable to open file %s\n", filename); |
| 1438 } | 1374 } |
| 1439 *size = file->Length(); | 1375 *size = file->Length(); |
| 1440 *buffer = reinterpret_cast<uint8_t*>(malloc(*size)); | 1376 *buffer = reinterpret_cast<uint8_t*>(malloc(*size)); |
| 1441 if (!file->ReadFully(*buffer, *size)) { | 1377 if (!file->ReadFully(*buffer, *size)) { |
| 1442 ErrorExit(kErrorExitCode, "Unable to read file %s\n", filename); | 1378 ErrorExit(kErrorExitCode, "Unable to read file %s\n", filename); |
| 1443 } | 1379 } |
| 1444 file->Release(); | 1380 file->Release(); |
| 1445 } | 1381 } |
| 1446 | 1382 |
| 1447 | |
| 1448 bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) { | 1383 bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) { |
| 1449 // Call CreateIsolateAndSetup which creates an isolate and loads up | 1384 // Call CreateIsolateAndSetup which creates an isolate and loads up |
| 1450 // the specified application script. | 1385 // the specified application script. |
| 1451 char* error = NULL; | 1386 char* error = NULL; |
| 1452 bool is_main_isolate = true; | 1387 bool is_main_isolate = true; |
| 1453 int exit_code = 0; | 1388 int exit_code = 0; |
| 1454 char* isolate_name = BuildIsolateName(script_name, "main"); | 1389 char* isolate_name = BuildIsolateName(script_name, "main"); |
| 1455 Dart_Isolate isolate = CreateIsolateAndSetupHelper( | 1390 Dart_Isolate isolate = CreateIsolateAndSetupHelper( |
| 1456 is_main_isolate, script_name, "main", commandline_package_root, | 1391 is_main_isolate, script_name, "main", commandline_package_root, |
| 1457 commandline_packages_file, NULL, &error, &exit_code); | 1392 commandline_packages_file, NULL, &error, &exit_code); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1485 } else { | 1420 } else { |
| 1486 // Lookup the library of the root script. | 1421 // Lookup the library of the root script. |
| 1487 Dart_Handle root_lib = Dart_RootLibrary(); | 1422 Dart_Handle root_lib = Dart_RootLibrary(); |
| 1488 // Import the root library into the builtin library so that we can easily | 1423 // Import the root library into the builtin library so that we can easily |
| 1489 // lookup the main entry point exported from the root library. | 1424 // lookup the main entry point exported from the root library. |
| 1490 IsolateData* isolate_data = | 1425 IsolateData* isolate_data = |
| 1491 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate)); | 1426 reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate)); |
| 1492 result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib, | 1427 result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib, |
| 1493 Dart_Null()); | 1428 Dart_Null()); |
| 1494 if ((gen_snapshot_kind == kAppAOT) || (gen_snapshot_kind == kAppJIT)) { | 1429 if ((gen_snapshot_kind == kAppAOT) || (gen_snapshot_kind == kAppJIT)) { |
| 1495 // Load the embedder's portion of the VM service's Dart code so it will | 1430 // Load the embedder's portion of the VM service's Dart code so it will |
| 1496 // be included in the app snapshot. | 1431 // be included in the app snapshot. |
| 1497 #if defined(DART_PRECOMPILED_RUNTIME) | 1432 #if defined(DART_PRECOMPILED_RUNTIME) |
| 1498 if (!VmService::LoadForGenPrecompiled(NULL)) { | 1433 if (!VmService::LoadForGenPrecompiled(NULL)) { |
| 1499 #else | 1434 #else |
| 1500 if (!VmService::LoadForGenPrecompiled(dfe.kernel_vmservice_io())) { | 1435 if (!VmService::LoadForGenPrecompiled(dfe.kernel_vmservice_io())) { |
| 1501 #endif // defined(DART_PRECOMPILED_RUNTIME) | 1436 #endif // defined(DART_PRECOMPILED_RUNTIME) |
| 1502 Log::PrintErr("VM service loading failed: %s\n", | 1437 Log::PrintErr("VM service loading failed: %s\n", |
| 1503 VmService::GetErrorMessage()); | 1438 VmService::GetErrorMessage()); |
| 1504 exit(kErrorExitCode); | 1439 exit(kErrorExitCode); |
| 1505 } | 1440 } |
| 1506 } | 1441 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1692 | 1627 |
| 1693 // Shutdown the isolate. | 1628 // Shutdown the isolate. |
| 1694 Dart_ShutdownIsolate(); | 1629 Dart_ShutdownIsolate(); |
| 1695 | 1630 |
| 1696 // No restart. | 1631 // No restart. |
| 1697 return false; | 1632 return false; |
| 1698 } | 1633 } |
| 1699 | 1634 |
| 1700 #undef CHECK_RESULT | 1635 #undef CHECK_RESULT |
| 1701 | 1636 |
| 1702 | |
| 1703 // Observatory assets are only needed in the regular dart binary. | 1637 // Observatory assets are only needed in the regular dart binary. |
| 1704 #if !defined(DART_PRECOMPILER) && !defined(NO_OBSERVATORY) | 1638 #if !defined(DART_PRECOMPILER) && !defined(NO_OBSERVATORY) |
| 1705 extern unsigned int observatory_assets_archive_len; | 1639 extern unsigned int observatory_assets_archive_len; |
| 1706 extern const uint8_t* observatory_assets_archive; | 1640 extern const uint8_t* observatory_assets_archive; |
| 1707 | 1641 |
| 1708 | |
| 1709 // |input| is assumed to be a gzipped stream. | 1642 // |input| is assumed to be a gzipped stream. |
| 1710 // This function allocates the output buffer in the C heap and the caller | 1643 // This function allocates the output buffer in the C heap and the caller |
| 1711 // is responsible for freeing it. | 1644 // is responsible for freeing it. |
| 1712 void Decompress(const uint8_t* input, | 1645 void Decompress(const uint8_t* input, |
| 1713 unsigned int input_len, | 1646 unsigned int input_len, |
| 1714 uint8_t** output, | 1647 uint8_t** output, |
| 1715 unsigned int* output_length) { | 1648 unsigned int* output_length) { |
| 1716 ASSERT(input != NULL); | 1649 ASSERT(input != NULL); |
| 1717 ASSERT(input_len > 0); | 1650 ASSERT(input_len > 0); |
| 1718 ASSERT(output != NULL); | 1651 ASSERT(output != NULL); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 | 1697 |
| 1765 // We've processed size_in bytes. | 1698 // We've processed size_in bytes. |
| 1766 input_cursor += size_in; | 1699 input_cursor += size_in; |
| 1767 | 1700 |
| 1768 // We're finished decompressing when zlib tells us. | 1701 // We're finished decompressing when zlib tells us. |
| 1769 } while (ret != Z_STREAM_END); | 1702 } while (ret != Z_STREAM_END); |
| 1770 | 1703 |
| 1771 inflateEnd(&strm); | 1704 inflateEnd(&strm); |
| 1772 } | 1705 } |
| 1773 | 1706 |
| 1774 | |
| 1775 Dart_Handle GetVMServiceAssetsArchiveCallback() { | 1707 Dart_Handle GetVMServiceAssetsArchiveCallback() { |
| 1776 uint8_t* decompressed = NULL; | 1708 uint8_t* decompressed = NULL; |
| 1777 unsigned int decompressed_len = 0; | 1709 unsigned int decompressed_len = 0; |
| 1778 Decompress(observatory_assets_archive, observatory_assets_archive_len, | 1710 Decompress(observatory_assets_archive, observatory_assets_archive_len, |
| 1779 &decompressed, &decompressed_len); | 1711 &decompressed, &decompressed_len); |
| 1780 Dart_Handle tar_file = | 1712 Dart_Handle tar_file = |
| 1781 DartUtils::MakeUint8Array(decompressed, decompressed_len); | 1713 DartUtils::MakeUint8Array(decompressed, decompressed_len); |
| 1782 // Free decompressed memory as it has been copied into a Dart array. | 1714 // Free decompressed memory as it has been copied into a Dart array. |
| 1783 free(decompressed); | 1715 free(decompressed); |
| 1784 return tar_file; | 1716 return tar_file; |
| 1785 } | 1717 } |
| 1786 #else // !defined(DART_PRECOMPILER) | 1718 #else // !defined(DART_PRECOMPILER) |
| 1787 static Dart_GetVMServiceAssetsArchive GetVMServiceAssetsArchiveCallback = NULL; | 1719 static Dart_GetVMServiceAssetsArchive GetVMServiceAssetsArchiveCallback = NULL; |
| 1788 #endif // !defined(DART_PRECOMPILER) | 1720 #endif // !defined(DART_PRECOMPILER) |
| 1789 | 1721 |
| 1790 | |
| 1791 void main(int argc, char** argv) { | 1722 void main(int argc, char** argv) { |
| 1792 char* script_name; | 1723 char* script_name; |
| 1793 const int EXTRA_VM_ARGUMENTS = 8; | 1724 const int EXTRA_VM_ARGUMENTS = 8; |
| 1794 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); | 1725 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); |
| 1795 CommandLineOptions dart_options(argc); | 1726 CommandLineOptions dart_options(argc); |
| 1796 bool print_flags_seen = false; | 1727 bool print_flags_seen = false; |
| 1797 bool verbose_debug_seen = false; | 1728 bool verbose_debug_seen = false; |
| 1798 | 1729 |
| 1799 // Perform platform specific initialization. | 1730 // Perform platform specific initialization. |
| 1800 if (!Platform::Initialize()) { | 1731 if (!Platform::Initialize()) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 Platform::Exit(Process::GlobalExitCode()); | 1886 Platform::Exit(Process::GlobalExitCode()); |
| 1956 } | 1887 } |
| 1957 | 1888 |
| 1958 } // namespace bin | 1889 } // namespace bin |
| 1959 } // namespace dart | 1890 } // namespace dart |
| 1960 | 1891 |
| 1961 int main(int argc, char** argv) { | 1892 int main(int argc, char** argv) { |
| 1962 dart::bin::main(argc, argv); | 1893 dart::bin::main(argc, argv); |
| 1963 UNREACHABLE(); | 1894 UNREACHABLE(); |
| 1964 } | 1895 } |
| OLD | NEW |