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/bootstrap.h" | 9 #include "vm/bootstrap.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 | 206 |
207 bool is_bootstrap_native = false; | 207 bool is_bootstrap_native = false; |
208 target_function = ResolveNativeFunction( | 208 target_function = ResolveNativeFunction( |
209 arguments->thread()->isolate(), func, &is_bootstrap_native); | 209 arguments->thread()->isolate(), func, &is_bootstrap_native); |
210 ASSERT(target_function != NULL); | 210 ASSERT(target_function != NULL); |
211 | 211 |
212 #if defined(DEBUG) | 212 #if defined(DEBUG) |
213 { | 213 { |
214 NativeFunction current_function = NULL; | 214 NativeFunction current_function = NULL; |
215 uword current_trampoline = | 215 const Code& current_trampoline = Code::Handle( |
216 CodePatcher::GetNativeCallAt(caller_frame->pc(), | 216 CodePatcher::GetNativeCallAt(caller_frame->pc(), |
217 code, | 217 code, |
218 ¤t_function); | 218 ¤t_function)); |
219 #if !defined(USING_SIMULATOR) | 219 #if !defined(USING_SIMULATOR) |
220 ASSERT(current_function == | 220 ASSERT(current_function == |
221 reinterpret_cast<NativeFunction>(LinkNativeCall)); | 221 reinterpret_cast<NativeFunction>(LinkNativeCall)); |
222 #else | 222 #else |
223 ASSERT(current_function == | 223 ASSERT(current_function == |
224 reinterpret_cast<NativeFunction>( | 224 reinterpret_cast<NativeFunction>( |
225 Simulator::RedirectExternalReference( | 225 Simulator::RedirectExternalReference( |
226 reinterpret_cast<uword>(LinkNativeCall), | 226 reinterpret_cast<uword>(LinkNativeCall), |
227 Simulator::kBootstrapNativeCall, | 227 Simulator::kBootstrapNativeCall, |
228 func.NumParameters()))); | 228 func.NumParameters()))); |
229 #endif | 229 #endif |
230 ASSERT(current_trampoline == | 230 ASSERT(current_trampoline.raw() == |
231 StubCode::CallBootstrapCFunction_entry()->EntryPoint()); | 231 StubCode::CallBootstrapCFunction_entry()->code()); |
232 } | 232 } |
233 #endif | 233 #endif |
234 | 234 |
235 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(func); | 235 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(func); |
236 const bool is_leaf_call = | 236 const bool is_leaf_call = |
237 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 237 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
238 | 238 |
239 call_through_wrapper = !is_bootstrap_native && !is_leaf_call; | 239 call_through_wrapper = !is_bootstrap_native && !is_leaf_call; |
240 | 240 |
241 const Code& trampoline = Code::Handle(call_through_wrapper ? | 241 const Code& trampoline = Code::Handle(call_through_wrapper ? |
(...skipping 26 matching lines...) Expand all Loading... |
268 if (call_through_wrapper) { | 268 if (call_through_wrapper) { |
269 NativeEntry::NativeCallWrapper( | 269 NativeEntry::NativeCallWrapper( |
270 args, reinterpret_cast<Dart_NativeFunction>(target_function)); | 270 args, reinterpret_cast<Dart_NativeFunction>(target_function)); |
271 } else { | 271 } else { |
272 target_function(arguments); | 272 target_function(arguments); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 | 276 |
277 } // namespace dart | 277 } // namespace dart |
OLD | NEW |