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 | 10 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 &vm_options, | 211 &vm_options, |
212 &script_name, | 212 &script_name, |
213 &dart_options) < 0) { | 213 &dart_options) < 0) { |
214 PrintUsage(); | 214 PrintUsage(); |
215 return 255; | 215 return 255; |
216 } | 216 } |
217 | 217 |
218 // Initialize the Dart VM (TODO(asiva) - remove const_cast once | 218 // Initialize the Dart VM (TODO(asiva) - remove const_cast once |
219 // dart API is fixed to take a const char** in Dart_Initialize). | 219 // dart API is fixed to take a const char** in Dart_Initialize). |
220 Dart_Initialize(vm_options.count(), | 220 Dart_Initialize(vm_options.count(), |
221 const_cast<char**>(vm_options.arguments()), | 221 vm_options.arguments(), |
222 MainIsolateInitCallback); | 222 MainIsolateInitCallback); |
223 | 223 |
224 // Create an isolate. As a side effect, MainIsolateInitCallback | 224 // Create an isolate. As a side effect, MainIsolateInitCallback |
225 // gets called, which loads the scripts and libraries. | 225 // gets called, which loads the scripts and libraries. |
226 char* canonical_script_name = File::GetCanonicalPath(script_name); | 226 char* canonical_script_name = File::GetCanonicalPath(script_name); |
227 if (canonical_script_name == NULL) { | 227 if (canonical_script_name == NULL) { |
228 fprintf(stderr, "Unable to find '%s'\n", script_name); | 228 fprintf(stderr, "Unable to find '%s'\n", script_name); |
229 return 255; // Indicates we encountered an error. | 229 return 255; // Indicates we encountered an error. |
230 } | 230 } |
231 Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer, | 231 Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 return 255; // Indicates we encountered an error. | 295 return 255; // Indicates we encountered an error. |
296 } | 296 } |
297 free(canonical_script_name); | 297 free(canonical_script_name); |
298 Dart_ExitScope(); | 298 Dart_ExitScope(); |
299 // Dump symbol information for the profiler. | 299 // Dump symbol information for the profiler. |
300 DumpPprofSymbolInfo(); | 300 DumpPprofSymbolInfo(); |
301 // Shutdown the isolate. | 301 // Shutdown the isolate. |
302 Dart_ShutdownIsolate(); | 302 Dart_ShutdownIsolate(); |
303 return 0; | 303 return 0; |
304 } | 304 } |
OLD | NEW |