Chromium Code Reviews| 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 jump; |
| 88 return reinterpret_cast<Dart_Isolate>(isolate); | 88 isolate->set_long_jump_base(&jump); |
| 89 if (setjmp(*jump.Set()) == 0) { | |
| 90 Dart::InitializeIsolate(snapshot, data); | |
| 91 START_TIMER(time_total_runtime); | |
| 92 isolate->set_long_jump_base(NULL); | |
|
Ivan Posva
2011/11/04 17:24:42
ditto.
siva
2011/11/04 22:01:57
Done.
| |
| 93 return reinterpret_cast<Dart_Isolate>(isolate); | |
| 94 } else { | |
| 95 { | |
| 96 Zone zone; // Setup a VM zone as we are creating some handles. | |
| 97 HandleScope scope; // Setup a VM handle scope. | |
| 98 const String& error = | |
| 99 String::Handle(Isolate::Current()->object_store()->sticky_error()); | |
| 100 // TODO(asiva): Need to return this as a error. | |
| 101 OS::PrintErr(error.ToCString()); | |
| 102 } | |
| 103 Dart::ShutdownIsolate(); | |
| 104 } | |
| 105 return reinterpret_cast<Dart_Isolate>(NULL); | |
| 89 } | 106 } |
| 90 | 107 |
| 91 | 108 |
| 92 DART_EXPORT void Dart_ShutdownIsolate() { | 109 DART_EXPORT void Dart_ShutdownIsolate() { |
| 93 ASSERT(Isolate::Current() != NULL); | 110 ASSERT(Isolate::Current() != NULL); |
| 94 STOP_TIMER(time_total_runtime); | 111 STOP_TIMER(time_total_runtime); |
| 95 Dart::ShutdownIsolate(); | 112 Dart::ShutdownIsolate(); |
| 96 } | 113 } |
| 97 | 114 |
| 98 | 115 |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1999 ASSERT(isolate != NULL); | 2016 ASSERT(isolate != NULL); |
| 2000 ApiState* state = isolate->api_state(); | 2017 ApiState* state = isolate->api_state(); |
| 2001 ASSERT(state != NULL); | 2018 ASSERT(state != NULL); |
| 2002 ApiLocalScope* scope = state->top_scope(); | 2019 ApiLocalScope* scope = state->top_scope(); |
| 2003 ASSERT(scope != NULL); | 2020 ASSERT(scope != NULL); |
| 2004 return scope->zone().Reallocate(ptr, old_size, new_size); | 2021 return scope->zone().Reallocate(ptr, old_size, new_size); |
| 2005 } | 2022 } |
| 2006 | 2023 |
| 2007 | 2024 |
| 2008 } // namespace dart | 2025 } // namespace dart |
| OLD | NEW |