| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 #include "vm/method_recognizer.h" | 5 #include "vm/method_recognizer.h" |
| 6 | 6 |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 #include "vm/symbols.h" | 8 #include "vm/symbols.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 MethodRecognizer::Kind MethodRecognizer::RecognizeKind( | 12 MethodRecognizer::Kind MethodRecognizer::RecognizeKind( |
| 13 const Function& function) { | 13 const Function& function) { |
| 14 return function.recognized_kind(); | 14 return function.recognized_kind(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 | 17 |
| 18 bool MethodRecognizer::AlwaysInline(const Function& function) { | 18 bool MethodRecognizer::AlwaysInline(const Function& function) { |
| 19 return function.always_inline(); | 19 return function.always_inline(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 | 22 |
| 23 bool MethodRecognizer::PolymorphicTarget(const Function& function) { | 23 bool MethodRecognizer::PolymorphicTarget(const Function& function) { |
| 24 return function.is_polymorphic_target(); | 24 return function.is_polymorphic_target(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 | 27 |
| 28 intptr_t MethodRecognizer::ResultCid(const Function& function) { | 28 intptr_t MethodRecognizer::ResultCid(const Function& function) { |
| 29 switch (function.recognized_kind()) { | 29 switch (function.recognized_kind()) { |
| 30 #define DEFINE_CASE(cname, fname, ename, result_type, fingerprint) \ | 30 #define DEFINE_CASE(cname, fname, ename, result_type, fingerprint) \ |
| 31 case k##ename: return k##result_type##Cid; | 31 case k##ename: \ |
| 32 return k##result_type##Cid; |
| 32 RECOGNIZED_LIST(DEFINE_CASE) | 33 RECOGNIZED_LIST(DEFINE_CASE) |
| 33 #undef DEFINE_CASE | 34 #undef DEFINE_CASE |
| 34 default: | 35 default: |
| 35 return kDynamicCid; | 36 return kDynamicCid; |
| 36 } | 37 } |
| 37 } | 38 } |
| 38 | 39 |
| 39 | 40 |
| 40 intptr_t MethodRecognizer::MethodKindToReceiverCid(Kind kind) { | 41 intptr_t MethodRecognizer::MethodKindToReceiverCid(Kind kind) { |
| 41 switch (kind) { | 42 switch (kind) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return kTypedDataFloat64x2ArrayCid; | 112 return kTypedDataFloat64x2ArrayCid; |
| 112 | 113 |
| 113 default: | 114 default: |
| 114 break; | 115 break; |
| 115 } | 116 } |
| 116 UNREACHABLE(); | 117 UNREACHABLE(); |
| 117 return kIllegalCid; | 118 return kIllegalCid; |
| 118 } | 119 } |
| 119 | 120 |
| 120 | 121 |
| 121 #define KIND_TO_STRING(class_name, function_name, enum_name, type, fp) \ | 122 #define KIND_TO_STRING(class_name, function_name, enum_name, type, fp) \ |
| 122 #enum_name, | 123 #enum_name, |
| 123 static const char* recognized_list_method_name[] = { | 124 static const char* recognized_list_method_name[] = { |
| 124 "Unknown", | 125 "Unknown", RECOGNIZED_LIST(KIND_TO_STRING)}; |
| 125 RECOGNIZED_LIST(KIND_TO_STRING) | |
| 126 }; | |
| 127 #undef KIND_TO_STRING | 126 #undef KIND_TO_STRING |
| 128 | 127 |
| 129 const char* MethodRecognizer::KindToCString(Kind kind) { | 128 const char* MethodRecognizer::KindToCString(Kind kind) { |
| 130 if (kind > kUnknown && kind < kNumRecognizedMethods) | 129 if (kind > kUnknown && kind < kNumRecognizedMethods) |
| 131 return recognized_list_method_name[kind]; | 130 return recognized_list_method_name[kind]; |
| 132 return "?"; | 131 return "?"; |
| 133 } | 132 } |
| 134 | 133 |
| 135 | 134 |
| 136 #if defined(DART_NO_SNAPSHOT) | 135 #if defined(DART_NO_SNAPSHOT) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 POLYMORPHIC_TARGET_LIST(SET_IS_POLYMORPHIC_TARGET); | 178 POLYMORPHIC_TARGET_LIST(SET_IS_POLYMORPHIC_TARGET); |
| 180 | 179 |
| 181 #undef SET_RECOGNIZED_KIND | 180 #undef SET_RECOGNIZED_KIND |
| 182 #undef SET_IS_ALWAYS_INLINE | 181 #undef SET_IS_ALWAYS_INLINE |
| 183 #undef SET_IS_POLYMORPHIC_TARGET | 182 #undef SET_IS_POLYMORPHIC_TARGET |
| 184 #undef SET_FUNCTION_BIT | 183 #undef SET_FUNCTION_BIT |
| 185 } | 184 } |
| 186 #endif // defined(DART_NO_SNAPSHOT). | 185 #endif // defined(DART_NO_SNAPSHOT). |
| 187 | 186 |
| 188 } // namespace dart | 187 } // namespace dart |
| OLD | NEW |