| 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/code_generator.h" | 10 #include "vm/code_generator.h" |
| 11 #include "vm/exceptions.h" | 11 #include "vm/exceptions.h" |
| 12 #include "vm/native_arguments.h" | 12 #include "vm/native_arguments.h" |
| 13 #include "vm/timer_scope.h" | |
| 14 #include "vm/verifier.h" | 13 #include "vm/verifier.h" |
| 15 | 14 |
| 16 #include "include/dart_api.h" | 15 #include "include/dart_api.h" |
| 17 | 16 |
| 18 namespace dart { | 17 namespace dart { |
| 19 | 18 |
| 20 // Forward declarations. | 19 // Forward declarations. |
| 21 class Class; | 20 class Class; |
| 22 class String; | 21 class String; |
| 23 | 22 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 #else | 33 #else |
| 35 #define SET_NATIVE_RETVAL(arguments, value) \ | 34 #define SET_NATIVE_RETVAL(arguments, value) \ |
| 36 arguments->SetReturnUnsafe(value); | 35 arguments->SetReturnUnsafe(value); |
| 37 #endif | 36 #endif |
| 38 | 37 |
| 39 #define DEFINE_NATIVE_ENTRY(name, argument_count) \ | 38 #define DEFINE_NATIVE_ENTRY(name, argument_count) \ |
| 40 static RawObject* DN_Helper##name(Isolate* isolate, \ | 39 static RawObject* DN_Helper##name(Isolate* isolate, \ |
| 41 NativeArguments* arguments); \ | 40 NativeArguments* arguments); \ |
| 42 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \ | 41 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \ |
| 43 CHECK_STACK_ALIGNMENT; \ | 42 CHECK_STACK_ALIGNMENT; \ |
| 43 VERIFY_ON_TRANSITION; \ |
| 44 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \ | 44 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \ |
| 45 DartToVmTimerScope timer(arguments->isolate()); \ | |
| 46 VERIFY_ON_TRANSITION; \ | |
| 47 ASSERT(arguments->NativeArgCount() == argument_count); \ | 45 ASSERT(arguments->NativeArgCount() == argument_count); \ |
| 48 TRACE_NATIVE_CALL("%s", ""#name); \ | 46 TRACE_NATIVE_CALL("%s", ""#name); \ |
| 49 { \ | 47 { \ |
| 50 StackZone zone(arguments->isolate()); \ | 48 StackZone zone(arguments->isolate()); \ |
| 51 SET_NATIVE_RETVAL(arguments, \ | 49 SET_NATIVE_RETVAL(arguments, \ |
| 52 DN_Helper##name(arguments->isolate(), arguments)); \ | 50 DN_Helper##name(arguments->isolate(), arguments)); \ |
| 53 DEOPTIMIZE_ALOT; \ | 51 DEOPTIMIZE_ALOT; \ |
| 54 } \ | 52 } \ |
| 55 VERIFY_ON_TRANSITION; \ | 53 VERIFY_ON_TRANSITION; \ |
| 56 } \ | 54 } \ |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 int number_of_arguments, | 96 int number_of_arguments, |
| 99 bool* auto_setup_scope); | 97 bool* auto_setup_scope); |
| 100 static void NativeCallWrapper(Dart_NativeArguments args, | 98 static void NativeCallWrapper(Dart_NativeArguments args, |
| 101 Dart_NativeFunction func); | 99 Dart_NativeFunction func); |
| 102 static const ExternalLabel& NativeCallWrapperLabel(); | 100 static const ExternalLabel& NativeCallWrapperLabel(); |
| 103 }; | 101 }; |
| 104 | 102 |
| 105 } // namespace dart | 103 } // namespace dart |
| 106 | 104 |
| 107 #endif // VM_NATIVE_ENTRY_H_ | 105 #endif // VM_NATIVE_ENTRY_H_ |
| OLD | NEW |