| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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" |
| 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/eventhandler.h" |
| 14 #include "bin/file.h" | 15 #include "bin/file.h" |
| 15 #include "bin/platform.h" | 16 #include "bin/platform.h" |
| 16 | 17 |
| 17 #include "platform/globals.h" | 18 #include "platform/globals.h" |
| 18 | 19 |
| 19 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise | 20 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise |
| 20 // it is initialized to NULL. | 21 // it is initialized to NULL. |
| 21 extern const uint8_t* snapshot_buffer; | 22 extern const uint8_t* snapshot_buffer; |
| 22 | 23 |
| 23 | 24 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 argv, | 375 argv, |
| 375 &vm_options, | 376 &vm_options, |
| 376 &script_name, | 377 &script_name, |
| 377 &dart_options) < 0) { | 378 &dart_options) < 0) { |
| 378 PrintUsage(); | 379 PrintUsage(); |
| 379 return 255; | 380 return 255; |
| 380 } | 381 } |
| 381 | 382 |
| 382 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 383 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 383 | 384 |
| 385 // Initialize event handler. |
| 386 EventHandler::Initialize(); |
| 387 |
| 384 // Initialize the Dart VM. | 388 // Initialize the Dart VM. |
| 385 Dart_Initialize(CreateIsolateAndSetup, NULL); | 389 Dart_Initialize(CreateIsolateAndSetup, NULL); |
| 386 | 390 |
| 387 canonical_script_name = File::GetCanonicalPath(script_name); | 391 canonical_script_name = File::GetCanonicalPath(script_name); |
| 388 if (canonical_script_name == NULL) { | 392 if (canonical_script_name == NULL) { |
| 389 fprintf(stderr, "Unable to find '%s'\n", script_name); | 393 fprintf(stderr, "Unable to find '%s'\n", script_name); |
| 390 return 255; // Indicates we encountered an error. | 394 return 255; // Indicates we encountered an error. |
| 391 } | 395 } |
| 392 | 396 |
| 393 // If application snapshot option is specified, first create the | 397 // If application snapshot option is specified, first create the |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 Dart_ShutdownIsolate(); | 501 Dart_ShutdownIsolate(); |
| 498 free(canonical_script_name); | 502 free(canonical_script_name); |
| 499 return 255; // Indicates we encountered an error. | 503 return 255; // Indicates we encountered an error. |
| 500 } | 504 } |
| 501 free(canonical_script_name); | 505 free(canonical_script_name); |
| 502 Dart_ExitScope(); | 506 Dart_ExitScope(); |
| 503 // Dump symbol information for the profiler. | 507 // Dump symbol information for the profiler. |
| 504 DumpPprofSymbolInfo(); | 508 DumpPprofSymbolInfo(); |
| 505 // Shutdown the isolate. | 509 // Shutdown the isolate. |
| 506 Dart_ShutdownIsolate(); | 510 Dart_ShutdownIsolate(); |
| 511 // Terminate event handler. |
| 512 EventHandler::Terminate(); |
| 513 |
| 507 return 0; | 514 return 0; |
| 508 } | 515 } |
| OLD | NEW |