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 #define KIND_TO_STRING(class_name, function_name, enum_name, fp) \ |
| 29 #enum_name, |
| 30 static const char* recognized_list_method_name[] = { |
| 31 RECOGNIZED_LIST(KIND_TO_STRING) |
| 32 }; |
| 33 #undef KIND_TO_STRING |
| 34 |
28 const char* MethodRecognizer::KindToCString(Kind kind) { | 35 const char* MethodRecognizer::KindToCString(Kind kind) { |
29 #define KIND_TO_STRING(class_name, function_name, enum_name, fp) \ | 36 if (kind > kUnknown && kind < kNumRecognizedMethods) |
30 if (kind == k##enum_name) return #enum_name; | 37 return recognized_list_method_name[kind]; |
31 RECOGNIZED_LIST(KIND_TO_STRING) | |
32 #undef KIND_TO_STRING | |
33 return "?"; | 38 return "?"; |
34 } | 39 } |
35 | 40 |
36 | 41 |
| 42 #if defined(DART_NO_SNAPSHOT) |
37 void MethodRecognizer::InitializeState() { | 43 void MethodRecognizer::InitializeState() { |
38 GrowableArray<Library*> libs(3); | 44 GrowableArray<Library*> libs(3); |
39 libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); | 45 libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); |
40 libs.Add(&Library::ZoneHandle(Library::CollectionLibrary())); | 46 libs.Add(&Library::ZoneHandle(Library::CollectionLibrary())); |
41 libs.Add(&Library::ZoneHandle(Library::MathLibrary())); | 47 libs.Add(&Library::ZoneHandle(Library::MathLibrary())); |
42 libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); | 48 libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); |
43 libs.Add(&Library::ZoneHandle(Library::InternalLibrary())); | 49 libs.Add(&Library::ZoneHandle(Library::InternalLibrary())); |
44 libs.Add(&Library::ZoneHandle(Library::ProfilerLibrary())); | 50 libs.Add(&Library::ZoneHandle(Library::ProfilerLibrary())); |
45 Function& func = Function::Handle(); | 51 Function& func = Function::Handle(); |
46 | 52 |
(...skipping 29 matching lines...) Expand all Loading... |
76 | 82 |
77 INLINE_WHITE_LIST(SET_IS_ALWAYS_INLINE); | 83 INLINE_WHITE_LIST(SET_IS_ALWAYS_INLINE); |
78 INLINE_BLACK_LIST(SET_IS_NEVER_INLINE); | 84 INLINE_BLACK_LIST(SET_IS_NEVER_INLINE); |
79 POLYMORPHIC_TARGET_LIST(SET_IS_POLYMORPHIC_TARGET); | 85 POLYMORPHIC_TARGET_LIST(SET_IS_POLYMORPHIC_TARGET); |
80 | 86 |
81 #undef SET_RECOGNIZED_KIND | 87 #undef SET_RECOGNIZED_KIND |
82 #undef SET_IS_ALWAYS_INLINE | 88 #undef SET_IS_ALWAYS_INLINE |
83 #undef SET_IS_POLYMORPHIC_TARGET | 89 #undef SET_IS_POLYMORPHIC_TARGET |
84 #undef SET_FUNCTION_BIT | 90 #undef SET_FUNCTION_BIT |
85 } | 91 } |
| 92 #endif // defined(DART_NO_SNAPSHOT). |
86 | 93 |
87 } // namespace dart | 94 } // namespace dart |
OLD | NEW |