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 #ifndef VM_DART_API_IMPL_H_ | 5 #ifndef VM_DART_API_IMPL_H_ |
6 #define VM_DART_API_IMPL_H_ | 6 #define VM_DART_API_IMPL_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/native_arguments.h" | 9 #include "vm/native_arguments.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/safepoint.h" |
11 | 12 |
12 namespace dart { | 13 namespace dart { |
13 | 14 |
14 class ApiLocalScope; | 15 class ApiLocalScope; |
15 class ApiState; | 16 class ApiState; |
16 class FinalizablePersistentHandle; | 17 class FinalizablePersistentHandle; |
17 class LocalHandle; | 18 class LocalHandle; |
18 class PersistentHandle; | 19 class PersistentHandle; |
19 class ReusableObjectHandleScope; | 20 class ReusableObjectHandleScope; |
20 | 21 |
(...skipping 23 matching lines...) Expand all Loading... |
44 // Checks that the current isolate is not NULL and that it has an API scope. | 45 // Checks that the current isolate is not NULL and that it has an API scope. |
45 #define CHECK_API_SCOPE(thread) \ | 46 #define CHECK_API_SCOPE(thread) \ |
46 do { \ | 47 do { \ |
47 Thread* tmpT = (thread); \ | 48 Thread* tmpT = (thread); \ |
48 Isolate* tmpI = tmpT->isolate(); \ | 49 Isolate* tmpI = tmpT->isolate(); \ |
49 CHECK_ISOLATE(tmpI); \ | 50 CHECK_ISOLATE(tmpI); \ |
50 if (tmpT->api_top_scope() == NULL) { \ | 51 if (tmpT->api_top_scope() == NULL) { \ |
51 FATAL1("%s expects to find a current scope. Did you forget to call " \ | 52 FATAL1("%s expects to find a current scope. Did you forget to call " \ |
52 "Dart_EnterScope?", CURRENT_FUNC); \ | 53 "Dart_EnterScope?", CURRENT_FUNC); \ |
53 } \ | 54 } \ |
54 } while (0) | 55 } while (0); \ |
55 | 56 |
56 #define DARTSCOPE(thread) \ | 57 #define DARTSCOPE(thread) \ |
57 Thread* T = (thread); \ | 58 Thread* T = (thread); \ |
58 CHECK_API_SCOPE(T); \ | 59 CHECK_API_SCOPE(T); \ |
| 60 TransitionNativeToVM trainsition(T); \ |
59 HANDLESCOPE(T); | 61 HANDLESCOPE(T); |
60 | 62 |
61 | 63 |
62 #define RETURN_TYPE_ERROR(zone, dart_handle, type) \ | 64 #define RETURN_TYPE_ERROR(zone, dart_handle, type) \ |
63 do { \ | 65 do { \ |
64 const Object& tmp = \ | 66 const Object& tmp = \ |
65 Object::Handle(zone, Api::UnwrapHandle((dart_handle))); \ | 67 Object::Handle(zone, Api::UnwrapHandle((dart_handle))); \ |
66 if (tmp.IsNull()) { \ | 68 if (tmp.IsNull()) { \ |
67 return Api::NewError("%s expects argument '%s' to be non-null.", \ | 69 return Api::NewError("%s expects argument '%s' to be non-null.", \ |
68 CURRENT_FUNC, #dart_handle); \ | 70 CURRENT_FUNC, #dart_handle); \ |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return Api::NewError("%s: Cannot load after Dart_Precompile", \ | 291 return Api::NewError("%s: Cannot load after Dart_Precompile", \ |
290 CURRENT_FUNC); \ | 292 CURRENT_FUNC); \ |
291 } \ | 293 } \ |
292 | 294 |
293 #define ASSERT_CALLBACK_STATE(thread) \ | 295 #define ASSERT_CALLBACK_STATE(thread) \ |
294 ASSERT(thread->no_callback_scope_depth() == 0) | 296 ASSERT(thread->no_callback_scope_depth() == 0) |
295 | 297 |
296 } // namespace dart. | 298 } // namespace dart. |
297 | 299 |
298 #endif // VM_DART_API_IMPL_H_ | 300 #endif // VM_DART_API_IMPL_H_ |
OLD | NEW |