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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 return NULL; | 458 return NULL; |
459 } | 459 } |
460 | 460 |
461 | 461 |
462 // --- Initialization and Globals --- | 462 // --- Initialization and Globals --- |
463 | 463 |
464 | 464 |
465 // TODO(iposva): This is a placeholder for the eventual external Dart API. | 465 // TODO(iposva): This is a placeholder for the eventual external Dart API. |
466 DART_EXPORT bool Dart_Initialize(int argc, | 466 DART_EXPORT bool Dart_Initialize(int argc, |
467 const char** argv, | 467 const char** argv, |
468 Dart_IsolateInitCallback callback) { | 468 Dart_IsolateCreateAndInitCallback callback) { |
469 return Dart::InitOnce(argc, argv, callback); | 469 return Dart::InitOnce(argc, argv, callback); |
470 } | 470 } |
471 | 471 |
472 | 472 |
473 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name) { | 473 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name) { |
474 if (Flags::Lookup(flag_name) != NULL) { | 474 if (Flags::Lookup(flag_name) != NULL) { |
475 return true; | 475 return true; |
476 } | 476 } |
477 return false; | 477 return false; |
478 } | 478 } |
479 | 479 |
480 | 480 |
481 // --- Isolates --- | 481 // --- Isolates --- |
482 | 482 |
483 | 483 |
484 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, | 484 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot) { |
485 void* data) { | |
486 Isolate* isolate = Dart::CreateIsolate(); | 485 Isolate* isolate = Dart::CreateIsolate(); |
487 ASSERT(isolate != NULL); | 486 ASSERT(isolate != NULL); |
488 LongJump* base = isolate->long_jump_base(); | 487 LongJump* base = isolate->long_jump_base(); |
489 LongJump jump; | 488 LongJump jump; |
490 isolate->set_long_jump_base(&jump); | 489 isolate->set_long_jump_base(&jump); |
491 if (setjmp(*jump.Set()) == 0) { | 490 if (setjmp(*jump.Set()) == 0) { |
492 Dart::InitializeIsolate(snapshot, data); | 491 Dart::InitializeIsolate(snapshot); |
493 START_TIMER(time_total_runtime); | 492 START_TIMER(time_total_runtime); |
494 isolate->set_long_jump_base(base); | 493 isolate->set_long_jump_base(base); |
495 return reinterpret_cast<Dart_Isolate>(isolate); | 494 return reinterpret_cast<Dart_Isolate>(isolate); |
496 } else { | 495 } else { |
497 { | 496 { |
498 DARTSCOPE(isolate); | 497 DARTSCOPE(isolate); |
499 const String& error = | 498 const String& error = |
500 String::Handle(isolate->object_store()->sticky_error()); | 499 String::Handle(isolate->object_store()->sticky_error()); |
501 // TODO(asiva): Need to return this as a error. | 500 // TODO(asiva): Need to return this as a error. |
502 OS::PrintErr(error.ToCString()); | 501 OS::PrintErr(error.ToCString()); |
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 } | 2294 } |
2296 delete debug_region; | 2295 delete debug_region; |
2297 } else { | 2296 } else { |
2298 *buffer = NULL; | 2297 *buffer = NULL; |
2299 *buffer_size = 0; | 2298 *buffer_size = 0; |
2300 } | 2299 } |
2301 } | 2300 } |
2302 | 2301 |
2303 | 2302 |
2304 } // namespace dart | 2303 } // namespace dart |
OLD | NEW |