| 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) { | 485 void* callback_data) { |
| 486 Isolate* isolate = Dart::CreateIsolate(); | 486 Isolate* isolate = Dart::CreateIsolate(); |
| 487 ASSERT(isolate != NULL); | 487 ASSERT(isolate != NULL); |
| 488 LongJump* base = isolate->long_jump_base(); | 488 LongJump* base = isolate->long_jump_base(); |
| 489 LongJump jump; | 489 LongJump jump; |
| 490 isolate->set_long_jump_base(&jump); | 490 isolate->set_long_jump_base(&jump); |
| 491 if (setjmp(*jump.Set()) == 0) { | 491 if (setjmp(*jump.Set()) == 0) { |
| 492 Dart::InitializeIsolate(snapshot, data); | 492 Dart::InitializeIsolate(snapshot, callback_data); |
| 493 START_TIMER(time_total_runtime); | 493 START_TIMER(time_total_runtime); |
| 494 isolate->set_long_jump_base(base); | 494 isolate->set_long_jump_base(base); |
| 495 return reinterpret_cast<Dart_Isolate>(isolate); | 495 return reinterpret_cast<Dart_Isolate>(isolate); |
| 496 } else { | 496 } else { |
| 497 { | 497 { |
| 498 DARTSCOPE(isolate); | 498 DARTSCOPE(isolate); |
| 499 const String& error = | 499 const String& error = |
| 500 String::Handle(isolate->object_store()->sticky_error()); | 500 String::Handle(isolate->object_store()->sticky_error()); |
| 501 // TODO(asiva): Need to return this as a error. | 501 // TODO(asiva): Need to return this as a error. |
| 502 OS::PrintErr(error.ToCString()); | 502 OS::PrintErr(error.ToCString()); |
| (...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2295 } | 2295 } |
| 2296 delete debug_region; | 2296 delete debug_region; |
| 2297 } else { | 2297 } else { |
| 2298 *buffer = NULL; | 2298 *buffer = NULL; |
| 2299 *buffer_size = 0; | 2299 *buffer_size = 0; |
| 2300 } | 2300 } |
| 2301 } | 2301 } |
| 2302 | 2302 |
| 2303 | 2303 |
| 2304 } // namespace dart | 2304 } // namespace dart |
| OLD | NEW |