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_RUNTIME_ENTRY_H_ | 5 #ifndef VM_RUNTIME_ENTRY_H_ |
6 #define VM_RUNTIME_ENTRY_H_ | 6 #define VM_RUNTIME_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/flags.h" | 10 #include "vm/flags.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry); | 60 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry); |
61 }; | 61 }; |
62 | 62 |
63 | 63 |
64 // Helper macros for declaring and defining runtime entries. | 64 // Helper macros for declaring and defining runtime entries. |
65 | 65 |
66 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ | 66 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ |
67 extern void DRT_##name(NativeArguments arguments); \ | 67 extern void DRT_##name(NativeArguments arguments); \ |
68 extern const RuntimeEntry k##name##RuntimeEntry( \ | 68 extern const RuntimeEntry k##name##RuntimeEntry( \ |
69 "DRT_"#name, &DRT_##name, argument_count, false, false); \ | 69 "DRT_"#name, &DRT_##name, argument_count, false, false); \ |
70 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments); \ | 70 static void DRT_Helper##name(Isolate* isolate, \ |
| 71 Thread* thread, \ |
| 72 Zone* zone, \ |
| 73 NativeArguments arguments); \ |
71 void DRT_##name(NativeArguments arguments) { \ | 74 void DRT_##name(NativeArguments arguments) { \ |
72 CHECK_STACK_ALIGNMENT; \ | 75 CHECK_STACK_ALIGNMENT; \ |
73 VERIFY_ON_TRANSITION; \ | 76 VERIFY_ON_TRANSITION; \ |
74 ASSERT(arguments.ArgCount() == argument_count); \ | 77 ASSERT(arguments.ArgCount() == argument_count); \ |
75 if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \ | 78 if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \ |
76 { \ | 79 { \ |
77 StackZone zone(arguments.isolate()); \ | 80 Isolate* isolate = arguments.isolate(); \ |
78 HANDLESCOPE(arguments.isolate()); \ | 81 Thread* thread = Thread::CurrentFromCurrentIsolate(isolate); \ |
79 DRT_Helper##name(arguments.isolate(), arguments); \ | 82 StackZone zone(isolate); \ |
| 83 HANDLESCOPE(isolate); \ |
| 84 DRT_Helper##name(isolate, thread, zone.GetZone(), arguments); \ |
80 } \ | 85 } \ |
81 VERIFY_ON_TRANSITION; \ | 86 VERIFY_ON_TRANSITION; \ |
82 } \ | 87 } \ |
83 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments) | 88 static void DRT_Helper##name(Isolate* isolate, \ |
| 89 Thread* thread, \ |
| 90 Zone* zone, \ |
| 91 NativeArguments arguments) |
84 | 92 |
85 #define DECLARE_RUNTIME_ENTRY(name) \ | 93 #define DECLARE_RUNTIME_ENTRY(name) \ |
86 extern const RuntimeEntry k##name##RuntimeEntry | 94 extern const RuntimeEntry k##name##RuntimeEntry |
87 | 95 |
88 #define DEFINE_LEAF_RUNTIME_ENTRY(type, name, argument_count, ...) \ | 96 #define DEFINE_LEAF_RUNTIME_ENTRY(type, name, argument_count, ...) \ |
89 extern "C" type DLRT_##name(__VA_ARGS__); \ | 97 extern "C" type DLRT_##name(__VA_ARGS__); \ |
90 extern const RuntimeEntry k##name##RuntimeEntry( \ | 98 extern const RuntimeEntry k##name##RuntimeEntry( \ |
91 "DLRT_"#name, reinterpret_cast<RuntimeFunction>(&DLRT_##name), \ | 99 "DLRT_"#name, reinterpret_cast<RuntimeFunction>(&DLRT_##name), \ |
92 argument_count, true, false); \ | 100 argument_count, true, false); \ |
93 type DLRT_##name(__VA_ARGS__) { \ | 101 type DLRT_##name(__VA_ARGS__) { \ |
94 CHECK_STACK_ALIGNMENT; \ | 102 CHECK_STACK_ALIGNMENT; \ |
95 NoGCScope no_gc_scope; \ | 103 NoGCScope no_gc_scope; \ |
96 | 104 |
97 #define END_LEAF_RUNTIME_ENTRY } | 105 #define END_LEAF_RUNTIME_ENTRY } |
98 | 106 |
99 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ | 107 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ |
100 extern const RuntimeEntry k##name##RuntimeEntry; \ | 108 extern const RuntimeEntry k##name##RuntimeEntry; \ |
101 extern "C" type DLRT_##name(__VA_ARGS__) | 109 extern "C" type DLRT_##name(__VA_ARGS__) |
102 | 110 |
103 } // namespace dart | 111 } // namespace dart |
104 | 112 |
105 #endif // VM_RUNTIME_ENTRY_H_ | 113 #endif // VM_RUNTIME_ENTRY_H_ |
OLD | NEW |