Chromium Code Reviews| 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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/native_arguments.h" | 10 #include "vm/native_arguments.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 #define DEFINE_NATIVE_ENTRY(name, argument_count) \ | 34 #define DEFINE_NATIVE_ENTRY(name, argument_count) \ |
| 35 static void DN_Helper##name(NativeArguments* arguments); \ | 35 static void DN_Helper##name(NativeArguments* arguments); \ |
| 36 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \ | 36 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \ |
| 37 CHECK_STACK_ALIGNMENT; \ | 37 CHECK_STACK_ALIGNMENT; \ |
| 38 VERIFY_ON_TRANSITION; \ | 38 VERIFY_ON_TRANSITION; \ |
| 39 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \ | 39 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \ |
| 40 ASSERT(arguments->Count() == argument_count); \ | 40 ASSERT(arguments->Count() == argument_count); \ |
| 41 if (FLAG_trace_natives) OS::Print("Calling native: %s\n", ""#name); \ | 41 if (FLAG_trace_natives) OS::Print("Calling native: %s\n", ""#name); \ |
| 42 { \ | 42 { \ |
| 43 Zone zone; \ | 43 Zone zone(arguments->isolate()); \ |
| 44 HANDLESCOPE(); \ | 44 HANDLESCOPE(arguments->isolate()); \ |
| 45 DN_Helper##name(arguments); \ | 45 DN_Helper##name(arguments); \ |
|
Ivan Posva
2011/11/11 22:07:07
DN_Helper##name(arguments->isolate(), arguments);
siva
2011/11/12 03:01:05
Done.
| |
| 46 } \ | 46 } \ |
| 47 VERIFY_ON_TRANSITION; \ | 47 VERIFY_ON_TRANSITION; \ |
| 48 } \ | 48 } \ |
| 49 static void DN_Helper##name(NativeArguments* arguments) | 49 static void DN_Helper##name(NativeArguments* arguments) |
|
Ivan Posva
2011/11/11 22:07:07
DN_Helper##name(Isolate* isolate, NativeArguments*
siva
2011/11/12 03:01:05
Done.
| |
| 50 | 50 |
| 51 | 51 |
| 52 #define DECLARE_NATIVE_ENTRY(name, argument_count) \ | 52 #define DECLARE_NATIVE_ENTRY(name, argument_count) \ |
| 53 extern void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments arguments); | 53 extern void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments arguments); |
| 54 | 54 |
| 55 // Natives should throw an exception if an illegal argument is passed. | 55 // Natives should throw an exception if an illegal argument is passed. |
| 56 // type name = value. | 56 // type name = value. |
| 57 #define GET_NATIVE_ARGUMENT(type, name, value) \ | 57 #define GET_NATIVE_ARGUMENT(type, name, value) \ |
| 58 type& name = type::Handle(); \ | 58 type& name = type::Handle(); \ |
| 59 { \ | 59 { \ |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 73 public: | 73 public: |
| 74 // Resolve specified dart native function to the actual native entrypoint. | 74 // Resolve specified dart native function to the actual native entrypoint. |
| 75 static NativeFunction ResolveNative(const Class& cls, | 75 static NativeFunction ResolveNative(const Class& cls, |
| 76 const String& function_name, | 76 const String& function_name, |
| 77 int number_of_arguments); | 77 int number_of_arguments); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace dart | 80 } // namespace dart |
| 81 | 81 |
| 82 #endif // VM_NATIVE_ENTRY_H_ | 82 #endif // VM_NATIVE_ENTRY_H_ |
| OLD | NEW |