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 "vm/native_entry.h" | 5 #include "vm/native_entry.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
| 11 #include "vm/tags.h" |
| 12 |
11 | 13 |
12 namespace dart { | 14 namespace dart { |
13 | 15 |
14 DEFINE_FLAG(bool, trace_natives, false, | 16 DEFINE_FLAG(bool, trace_natives, false, |
15 "Trace invocation of natives (debug mode only)"); | 17 "Trace invocation of natives (debug mode only)"); |
16 | 18 |
17 | 19 |
18 static ExternalLabel native_call_label( | 20 static ExternalLabel native_call_label( |
19 "native_function_call", | 21 "native_function_call", |
20 reinterpret_cast<uword>(&NativeEntry::NativeCallWrapper)); | 22 reinterpret_cast<uword>(&NativeEntry::NativeCallWrapper)); |
(...skipping 23 matching lines...) Expand all Loading... |
44 return native_call_label; | 46 return native_call_label; |
45 } | 47 } |
46 | 48 |
47 | 49 |
48 void NativeEntry::NativeCallWrapper(Dart_NativeArguments args, | 50 void NativeEntry::NativeCallWrapper(Dart_NativeArguments args, |
49 Dart_NativeFunction func) { | 51 Dart_NativeFunction func) { |
50 CHECK_STACK_ALIGNMENT; | 52 CHECK_STACK_ALIGNMENT; |
51 VERIFY_ON_TRANSITION; | 53 VERIFY_ON_TRANSITION; |
52 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 54 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
53 Isolate* isolate = arguments->isolate(); | 55 Isolate* isolate = arguments->isolate(); |
| 56 VMTagScope tagScope(isolate, VMTag::kRuntimeNativeTagId); |
54 ApiState* state = isolate->api_state(); | 57 ApiState* state = isolate->api_state(); |
55 ASSERT(state != NULL); | 58 ASSERT(state != NULL); |
56 ApiLocalScope* current_top_scope = state->top_scope(); | 59 ApiLocalScope* current_top_scope = state->top_scope(); |
57 ApiLocalScope* scope = state->reusable_scope(); | 60 ApiLocalScope* scope = state->reusable_scope(); |
58 TRACE_NATIVE_CALL("0x%" Px "", reinterpret_cast<uintptr_t>(func)); | 61 TRACE_NATIVE_CALL("0x%" Px "", reinterpret_cast<uintptr_t>(func)); |
59 if (scope == NULL) { | 62 if (scope == NULL) { |
60 scope = new ApiLocalScope(current_top_scope, | 63 scope = new ApiLocalScope(current_top_scope, |
61 isolate->top_exit_frame_info()); | 64 isolate->top_exit_frame_info()); |
62 ASSERT(scope != NULL); | 65 ASSERT(scope != NULL); |
63 } else { | 66 } else { |
(...skipping 13 matching lines...) Expand all Loading... |
77 state->set_reusable_scope(scope); | 80 state->set_reusable_scope(scope); |
78 } else { | 81 } else { |
79 ASSERT(state->reusable_scope() != scope); | 82 ASSERT(state->reusable_scope() != scope); |
80 delete scope; | 83 delete scope; |
81 } | 84 } |
82 DEOPTIMIZE_ALOT; | 85 DEOPTIMIZE_ALOT; |
83 VERIFY_ON_TRANSITION; | 86 VERIFY_ON_TRANSITION; |
84 } | 87 } |
85 | 88 |
86 } // namespace dart | 89 } // namespace dart |
OLD | NEW |