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