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" |
11 #include "vm/dart_api_impl.h" | 11 #include "vm/dart_api_impl.h" |
12 #include "vm/dart_api_state.h" | 12 #include "vm/dart_api_state.h" |
13 #include "vm/object_store.h" | 13 #include "vm/object_store.h" |
14 #include "vm/reusable_handles.h" | 14 #include "vm/reusable_handles.h" |
15 #include "vm/safepoint.h" | 15 #include "vm/safepoint.h" |
16 #include "vm/stack_frame.h" | 16 #include "vm/stack_frame.h" |
17 #include "vm/symbols.h" | 17 #include "vm/symbols.h" |
18 #include "vm/tags.h" | 18 #include "vm/tags.h" |
19 | 19 |
20 | 20 |
21 namespace dart { | 21 namespace dart { |
22 | 22 |
23 DEFINE_FLAG(bool, trace_natives, false, | 23 DEFINE_FLAG(bool, trace_natives, false, |
24 "Trace invocation of natives (debug mode only)"); | 24 "Trace invocation of natives (debug mode only)"); |
25 | 25 |
26 | 26 |
| 27 void DartNativeThrowArgumentException(const Instance& instance) { |
| 28 const Array& __args__ = Array::Handle(Array::New(1)); |
| 29 __args__.SetAt(0, instance); |
| 30 Exceptions::ThrowByType(Exceptions::kArgument, __args__); |
| 31 } |
| 32 |
| 33 |
27 NativeFunction NativeEntry::ResolveNative(const Library& library, | 34 NativeFunction NativeEntry::ResolveNative(const Library& library, |
28 const String& function_name, | 35 const String& function_name, |
29 int number_of_arguments, | 36 int number_of_arguments, |
30 bool* auto_setup_scope) { | 37 bool* auto_setup_scope) { |
31 // Now resolve the native function to the corresponding native entrypoint. | 38 // Now resolve the native function to the corresponding native entrypoint. |
32 if (library.native_entry_resolver() == 0) { | 39 if (library.native_entry_resolver() == 0) { |
33 // Native methods are not allowed in the library to which this | 40 // Native methods are not allowed in the library to which this |
34 // class belongs in. | 41 // class belongs in. |
35 return NULL; | 42 return NULL; |
36 } | 43 } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (call_through_wrapper) { | 283 if (call_through_wrapper) { |
277 NativeEntry::NativeCallWrapper( | 284 NativeEntry::NativeCallWrapper( |
278 args, reinterpret_cast<Dart_NativeFunction>(target_function)); | 285 args, reinterpret_cast<Dart_NativeFunction>(target_function)); |
279 } else { | 286 } else { |
280 target_function(arguments); | 287 target_function(arguments); |
281 } | 288 } |
282 } | 289 } |
283 | 290 |
284 | 291 |
285 } // namespace dart | 292 } // namespace dart |
OLD | NEW |