| 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_NATIVE_ENTRY_H_ | 5 #ifndef VM_NATIVE_ENTRY_H_ |
| 6 #define VM_NATIVE_ENTRY_H_ | 6 #define VM_NATIVE_ENTRY_H_ |
| 7 | 7 |
| 8 #include "platform/memory_sanitizer.h" | 8 #include "platform/memory_sanitizer.h" |
| 9 | 9 |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 Exceptions::ThrowByType(Exceptions::kArgument, __args__); \ | 81 Exceptions::ThrowByType(Exceptions::kArgument, __args__); \ |
| 82 } \ | 82 } \ |
| 83 const type& name = type::Cast(__##name##_instance__); | 83 const type& name = type::Cast(__##name##_instance__); |
| 84 | 84 |
| 85 | 85 |
| 86 // Natives should throw an exception if an illegal argument is passed. | 86 // Natives should throw an exception if an illegal argument is passed. |
| 87 // type name = value. | 87 // type name = value. |
| 88 #define GET_NATIVE_ARGUMENT(type, name, value) \ | 88 #define GET_NATIVE_ARGUMENT(type, name, value) \ |
| 89 const Instance& __##name##_instance__ = \ | 89 const Instance& __##name##_instance__ = \ |
| 90 Instance::CheckedHandle(zone, value); \ | 90 Instance::CheckedHandle(zone, value); \ |
| 91 type& name = type::Handle(isolate); \ | 91 type& name = type::Handle(zone); \ |
| 92 if (!__##name##_instance__.IsNull()) { \ | 92 if (!__##name##_instance__.IsNull()) { \ |
| 93 if (!__##name##_instance__.Is##type()) { \ | 93 if (!__##name##_instance__.Is##type()) { \ |
| 94 const Array& __args__ = Array::Handle(Array::New(1)); \ | 94 const Array& __args__ = Array::Handle(Array::New(1)); \ |
| 95 __args__.SetAt(0, __##name##_instance__); \ | 95 __args__.SetAt(0, __##name##_instance__); \ |
| 96 Exceptions::ThrowByType(Exceptions::kArgument, __args__); \ | 96 Exceptions::ThrowByType(Exceptions::kArgument, __args__); \ |
| 97 } \ | 97 } \ |
| 98 } \ | 98 } \ |
| 99 name ^= value; | 99 name ^= value; |
| 100 | 100 |
| 101 | 101 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 118 static void NativeCallWrapper(Dart_NativeArguments args, | 118 static void NativeCallWrapper(Dart_NativeArguments args, |
| 119 Dart_NativeFunction func); | 119 Dart_NativeFunction func); |
| 120 | 120 |
| 121 static uword LinkNativeCallEntry(); | 121 static uword LinkNativeCallEntry(); |
| 122 static void LinkNativeCall(Dart_NativeArguments args); | 122 static void LinkNativeCall(Dart_NativeArguments args); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace dart | 125 } // namespace dart |
| 126 | 126 |
| 127 #endif // VM_NATIVE_ENTRY_H_ | 127 #endif // VM_NATIVE_ENTRY_H_ |
| OLD | NEW |