Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: runtime/vm/method_recognizer.cc

Issue 2023423002: Revert "VM: Add result cid information for recognized methods." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #define KIND_TO_STRING(class_name, function_name, enum_name, fp) \
29 switch (function.recognized_kind()) {
30 #define DEFINE_CASE(cname, fname, ename, result_type, fingerprint) \
31 case k##ename: return k##result_type##Cid;
32 RECOGNIZED_LIST(DEFINE_CASE)
33 #undef DEFINE_CASE
34 default:
35 return kDynamicCid;
36 }
37 }
38
39
40 #define KIND_TO_STRING(class_name, function_name, enum_name, type, fp) \
41 #enum_name, 29 #enum_name,
42 static const char* recognized_list_method_name[] = { 30 static const char* recognized_list_method_name[] = {
43 "Unknown", 31 "Unknown",
44 RECOGNIZED_LIST(KIND_TO_STRING) 32 RECOGNIZED_LIST(KIND_TO_STRING)
45 }; 33 };
46 #undef KIND_TO_STRING 34 #undef KIND_TO_STRING
47 35
48 const char* MethodRecognizer::KindToCString(Kind kind) { 36 const char* MethodRecognizer::KindToCString(Kind kind) {
49 if (kind > kUnknown && kind < kNumRecognizedMethods) 37 if (kind > kUnknown && kind < kNumRecognizedMethods)
50 return recognized_list_method_name[kind]; 38 return recognized_list_method_name[kind];
51 return "?"; 39 return "?";
52 } 40 }
53 41
54 42
55 #if defined(DART_NO_SNAPSHOT) 43 #if defined(DART_NO_SNAPSHOT)
56 void MethodRecognizer::InitializeState() { 44 void MethodRecognizer::InitializeState() {
57 GrowableArray<Library*> libs(3); 45 GrowableArray<Library*> libs(3);
58 libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); 46 libs.Add(&Library::ZoneHandle(Library::CoreLibrary()));
59 libs.Add(&Library::ZoneHandle(Library::CollectionLibrary())); 47 libs.Add(&Library::ZoneHandle(Library::CollectionLibrary()));
60 libs.Add(&Library::ZoneHandle(Library::MathLibrary())); 48 libs.Add(&Library::ZoneHandle(Library::MathLibrary()));
61 libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); 49 libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
62 libs.Add(&Library::ZoneHandle(Library::InternalLibrary())); 50 libs.Add(&Library::ZoneHandle(Library::InternalLibrary()));
63 libs.Add(&Library::ZoneHandle(Library::DeveloperLibrary())); 51 libs.Add(&Library::ZoneHandle(Library::DeveloperLibrary()));
64 Function& func = Function::Handle(); 52 Function& func = Function::Handle();
65 53
66 #define SET_RECOGNIZED_KIND(class_name, function_name, enum_name, type, fp) \ 54 #define SET_RECOGNIZED_KIND(class_name, function_name, enum_name, fp) \
67 func = Library::GetFunction(libs, #class_name, #function_name); \ 55 func = Library::GetFunction(libs, #class_name, #function_name); \
68 if (func.IsNull()) { \ 56 if (func.IsNull()) { \
69 OS::PrintErr("Missing %s::%s\n", #class_name, #function_name); \ 57 OS::PrintErr("Missing %s::%s\n", #class_name, #function_name); \
70 UNREACHABLE(); \ 58 UNREACHABLE(); \
71 } \ 59 } \
72 CHECK_FINGERPRINT3(func, class_name, function_name, enum_name, fp); \ 60 CHECK_FINGERPRINT3(func, class_name, function_name, enum_name, fp); \
73 func.set_recognized_kind(k##enum_name); 61 func.set_recognized_kind(k##enum_name);
74 62
75 RECOGNIZED_LIST(SET_RECOGNIZED_KIND); 63 RECOGNIZED_LIST(SET_RECOGNIZED_KIND);
76 64
77 #define SET_FUNCTION_BIT(class_name, function_name, dest, fp, setter, value) \ 65 #define SET_FUNCTION_BIT(class_name, function_name, dest, fp, setter, value) \
78 func = Library::GetFunction(libs, #class_name, #function_name); \ 66 func = Library::GetFunction(libs, #class_name, #function_name); \
79 if (func.IsNull()) { \ 67 if (func.IsNull()) { \
80 OS::PrintErr("Missing %s::%s\n", #class_name, #function_name); \ 68 OS::PrintErr("Missing %s::%s\n", #class_name, #function_name); \
81 UNREACHABLE(); \ 69 UNREACHABLE(); \
82 } \ 70 } \
83 CHECK_FINGERPRINT3(func, class_name, function_name, dest, fp); \ 71 CHECK_FINGERPRINT3(func, class_name, function_name, dest, fp); \
84 func.setter(value); 72 func.setter(value);
85 73
86 #define SET_IS_ALWAYS_INLINE(class_name, function_name, dest, fp) \ 74 #define SET_IS_ALWAYS_INLINE(class_name, function_name, dest, fp) \
87 SET_FUNCTION_BIT(class_name, function_name, dest, fp, set_always_inline, true) 75 SET_FUNCTION_BIT(class_name, function_name, dest, fp, set_always_inline, true)
88 76
89 #define SET_IS_NEVER_INLINE(class_name, function_name, dest, fp) \ 77 #define SET_IS_NEVER_INLINE(class_name, function_name, dest, fp) \
90 SET_FUNCTION_BIT(class_name, function_name, dest, fp, set_is_inlinable, false) 78 SET_FUNCTION_BIT(class_name, function_name, dest, fp, set_is_inlinable, false)
91 79
92 #define SET_IS_POLYMORPHIC_TARGET(class_name, function_name, dest, fp) \ 80 #define SET_IS_POLYMORPHIC_TARGET(class_name, function_name, dest, fp) \
93 SET_FUNCTION_BIT(class_name, function_name, dest, fp, \ 81 SET_FUNCTION_BIT(class_name, function_name, dest, fp, \
94 set_is_polymorphic_target, true) 82 set_is_polymorphic_target, true)
95 83
96 INLINE_WHITE_LIST(SET_IS_ALWAYS_INLINE); 84 INLINE_WHITE_LIST(SET_IS_ALWAYS_INLINE);
97 INLINE_BLACK_LIST(SET_IS_NEVER_INLINE); 85 INLINE_BLACK_LIST(SET_IS_NEVER_INLINE);
98 POLYMORPHIC_TARGET_LIST(SET_IS_POLYMORPHIC_TARGET); 86 POLYMORPHIC_TARGET_LIST(SET_IS_POLYMORPHIC_TARGET);
99 87
100 #undef SET_RECOGNIZED_KIND 88 #undef SET_RECOGNIZED_KIND
101 #undef SET_IS_ALWAYS_INLINE 89 #undef SET_IS_ALWAYS_INLINE
102 #undef SET_IS_POLYMORPHIC_TARGET 90 #undef SET_IS_POLYMORPHIC_TARGET
103 #undef SET_FUNCTION_BIT 91 #undef SET_FUNCTION_BIT
104 } 92 }
105 #endif // defined(DART_NO_SNAPSHOT). 93 #endif // defined(DART_NO_SNAPSHOT).
106 94
107 } // namespace dart 95 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698