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 RUNTIME_VM_RUNTIME_ENTRY_H_ | 5 #ifndef RUNTIME_VM_RUNTIME_ENTRY_H_ |
6 #define RUNTIME_VM_RUNTIME_ENTRY_H_ | 6 #define RUNTIME_VM_RUNTIME_ENTRY_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/native_arguments.h" | 10 #include "vm/native_arguments.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // TODO(rmacnak): Fix alignment issue on simarm and use | 133 // TODO(rmacnak): Fix alignment issue on simarm and use |
134 // DEFINE_LEAF_RUNTIME_ENTRY instead. | 134 // DEFINE_LEAF_RUNTIME_ENTRY instead. |
135 #define DEFINE_RAW_LEAF_RUNTIME_ENTRY(name, argument_count, is_float, func) \ | 135 #define DEFINE_RAW_LEAF_RUNTIME_ENTRY(name, argument_count, is_float, func) \ |
136 extern const RuntimeEntry k##name##RuntimeEntry( \ | 136 extern const RuntimeEntry k##name##RuntimeEntry( \ |
137 "DFLRT_" #name, func, argument_count, true, is_float) | 137 "DFLRT_" #name, func, argument_count, true, is_float) |
138 | 138 |
139 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ | 139 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ |
140 extern const RuntimeEntry k##name##RuntimeEntry; \ | 140 extern const RuntimeEntry k##name##RuntimeEntry; \ |
141 extern "C" type DLRT_##name(__VA_ARGS__); | 141 extern "C" type DLRT_##name(__VA_ARGS__); |
142 | 142 |
143 | |
144 // Declare all runtime functions here. | 143 // Declare all runtime functions here. |
145 RUNTIME_ENTRY_LIST(DECLARE_RUNTIME_ENTRY) | 144 RUNTIME_ENTRY_LIST(DECLARE_RUNTIME_ENTRY) |
146 LEAF_RUNTIME_ENTRY_LIST(DECLARE_LEAF_RUNTIME_ENTRY) | 145 LEAF_RUNTIME_ENTRY_LIST(DECLARE_LEAF_RUNTIME_ENTRY) |
147 | 146 |
148 | |
149 uword RuntimeEntry::AddressFromId(RuntimeFunctionId id) { | 147 uword RuntimeEntry::AddressFromId(RuntimeFunctionId id) { |
150 switch (id) { | 148 switch (id) { |
151 #define DEFINE_RUNTIME_CASE(name) \ | 149 #define DEFINE_RUNTIME_CASE(name) \ |
152 case k##name##Id: \ | 150 case k##name##Id: \ |
153 return k##name##RuntimeEntry.GetEntryPoint(); | 151 return k##name##RuntimeEntry.GetEntryPoint(); |
154 RUNTIME_ENTRY_LIST(DEFINE_RUNTIME_CASE) | 152 RUNTIME_ENTRY_LIST(DEFINE_RUNTIME_CASE) |
155 #undef DEFINE_RUNTIME_CASE | 153 #undef DEFINE_RUNTIME_CASE |
156 | 154 |
157 #define DEFINE_LEAF_RUNTIME_CASE(type, name, ...) \ | 155 #define DEFINE_LEAF_RUNTIME_CASE(type, name, ...) \ |
158 case k##name##Id: \ | 156 case k##name##Id: \ |
159 return k##name##RuntimeEntry.GetEntryPoint(); | 157 return k##name##RuntimeEntry.GetEntryPoint(); |
160 LEAF_RUNTIME_ENTRY_LIST(DEFINE_LEAF_RUNTIME_CASE) | 158 LEAF_RUNTIME_ENTRY_LIST(DEFINE_LEAF_RUNTIME_CASE) |
161 #undef DEFINE_LEAF_RUNTIME_CASE | 159 #undef DEFINE_LEAF_RUNTIME_CASE |
162 default: | 160 default: |
163 break; | 161 break; |
164 } | 162 } |
165 return 0; | 163 return 0; |
166 } | 164 } |
167 | 165 |
168 | |
169 RuntimeFunctionId RuntimeEntry::RuntimeFunctionIdFromAddress(uword address) { | 166 RuntimeFunctionId RuntimeEntry::RuntimeFunctionIdFromAddress(uword address) { |
170 #define CHECK_RUNTIME_ADDRESS(name) \ | 167 #define CHECK_RUNTIME_ADDRESS(name) \ |
171 if (address == k##name##RuntimeEntry.GetEntryPoint()) return k##name##Id; | 168 if (address == k##name##RuntimeEntry.GetEntryPoint()) return k##name##Id; |
172 RUNTIME_ENTRY_LIST(CHECK_RUNTIME_ADDRESS) | 169 RUNTIME_ENTRY_LIST(CHECK_RUNTIME_ADDRESS) |
173 #undef CHECK_RUNTIME_ADDRESS | 170 #undef CHECK_RUNTIME_ADDRESS |
174 | 171 |
175 #define CHECK_LEAF_RUNTIME_ADDRESS(type, name, ...) \ | 172 #define CHECK_LEAF_RUNTIME_ADDRESS(type, name, ...) \ |
176 if (address == k##name##RuntimeEntry.GetEntryPoint()) return k##name##Id; | 173 if (address == k##name##RuntimeEntry.GetEntryPoint()) return k##name##Id; |
177 LEAF_RUNTIME_ENTRY_LIST(CHECK_LEAF_RUNTIME_ADDRESS) | 174 LEAF_RUNTIME_ENTRY_LIST(CHECK_LEAF_RUNTIME_ADDRESS) |
178 #undef CHECK_LEAF_RUNTIME_ADDRESS | 175 #undef CHECK_LEAF_RUNTIME_ADDRESS |
179 return kNoRuntimeFunctionId; | 176 return kNoRuntimeFunctionId; |
180 } | 177 } |
181 | 178 |
182 const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason); | 179 const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason); |
183 | 180 |
184 void DeoptimizeAt(const Code& optimized_code, StackFrame* frame); | 181 void DeoptimizeAt(const Code& optimized_code, StackFrame* frame); |
185 void DeoptimizeFunctionsOnStack(); | 182 void DeoptimizeFunctionsOnStack(); |
186 | 183 |
187 double DartModulo(double a, double b); | 184 double DartModulo(double a, double b); |
188 | 185 |
189 } // namespace dart | 186 } // namespace dart |
190 | 187 |
191 #endif // RUNTIME_VM_RUNTIME_ENTRY_H_ | 188 #endif // RUNTIME_VM_RUNTIME_ENTRY_H_ |
OLD | NEW |