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