| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // TODO(iposva): This is a placeholder for the eventual external Dart API. | 75 // TODO(iposva): This is a placeholder for the eventual external Dart API. |
| 76 DART_EXPORT bool Dart_Initialize(int argc, | 76 DART_EXPORT bool Dart_Initialize(int argc, |
| 77 char** argv, | 77 char** argv, |
| 78 Dart_IsolateInitCallback callback) { | 78 Dart_IsolateInitCallback callback) { |
| 79 return Dart::InitOnce(argc, argv, callback); | 79 return Dart::InitOnce(argc, argv, callback); |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, | 83 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, |
| 84 void* data) { | 84 void* data) { |
| 85 ASSERT(Isolate::Current() == NULL); | 85 Isolate* isolate = Dart::CreateIsolate(); |
| 86 Isolate* isolate = Dart::CreateIsolate(snapshot, data); | 86 ASSERT(isolate != NULL); |
| 87 START_TIMER(time_total_runtime); | 87 LongJump* base = isolate->long_jump_base(); |
| 88 return reinterpret_cast<Dart_Isolate>(isolate); | 88 LongJump jump; |
| 89 isolate->set_long_jump_base(&jump); |
| 90 if (setjmp(*jump.Set()) == 0) { |
| 91 Dart::InitializeIsolate(snapshot, data); |
| 92 START_TIMER(time_total_runtime); |
| 93 isolate->set_long_jump_base(base); |
| 94 return reinterpret_cast<Dart_Isolate>(isolate); |
| 95 } else { |
| 96 { |
| 97 Zone zone; // Setup a VM zone as we are creating some handles. |
| 98 HandleScope scope; // Setup a VM handle scope. |
| 99 const String& error = |
| 100 String::Handle(Isolate::Current()->object_store()->sticky_error()); |
| 101 // TODO(asiva): Need to return this as a error. |
| 102 OS::PrintErr(error.ToCString()); |
| 103 } |
| 104 Dart::ShutdownIsolate(); |
| 105 } |
| 106 return reinterpret_cast<Dart_Isolate>(NULL); |
| 89 } | 107 } |
| 90 | 108 |
| 91 | 109 |
| 92 DART_EXPORT void Dart_ShutdownIsolate() { | 110 DART_EXPORT void Dart_ShutdownIsolate() { |
| 93 ASSERT(Isolate::Current() != NULL); | 111 ASSERT(Isolate::Current() != NULL); |
| 94 STOP_TIMER(time_total_runtime); | 112 STOP_TIMER(time_total_runtime); |
| 95 Dart::ShutdownIsolate(); | 113 Dart::ShutdownIsolate(); |
| 96 } | 114 } |
| 97 | 115 |
| 98 | 116 |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 ASSERT(isolate != NULL); | 2017 ASSERT(isolate != NULL); |
| 2000 ApiState* state = isolate->api_state(); | 2018 ApiState* state = isolate->api_state(); |
| 2001 ASSERT(state != NULL); | 2019 ASSERT(state != NULL); |
| 2002 ApiLocalScope* scope = state->top_scope(); | 2020 ApiLocalScope* scope = state->top_scope(); |
| 2003 ASSERT(scope != NULL); | 2021 ASSERT(scope != NULL); |
| 2004 return scope->zone().Reallocate(ptr, old_size, new_size); | 2022 return scope->zone().Reallocate(ptr, old_size, new_size); |
| 2005 } | 2023 } |
| 2006 | 2024 |
| 2007 | 2025 |
| 2008 } // namespace dart | 2026 } // namespace dart |
| OLD | NEW |