16 switch (
function.recognized_kind()) {
17 case MethodRecognizer::kDoubleFromInteger:
18 case MethodRecognizer::kMathMin:
19 case MethodRecognizer::kMathMax:
27 const Object& function_or_field) {
32 Symbols::vm_exact_result_type(),
34 if (option.IsType()) {
35 return Type::Cast(option).type_class_id();
36 }
else if (option.IsString()) {
37 auto& str = String::Cast(option);
40 bool parse_failure =
false;
41 intptr_t library_end = -1;
42 for (intptr_t
i = 0;
i < str.Length(); ++
i) {
43 if (str.CharAt(
i) ==
'#') {
44 if (library_end != -1) {
52 if (!parse_failure && library_end > 0) {
56 if (!library.IsNull()) {
61 if (!klass.IsNull()) {
66 }
else if (option.IsArray()) {
67 const Array& array = Array::Cast(option);
71 return Type::Cast(
type).type_class_id();
82 case kObjectArrayGetIndexed:
83 case kObjectArraySetIndexed:
84 case kObjectArraySetIndexedUnchecked:
87 case kGrowableArrayGetIndexed:
88 case kGrowableArraySetIndexed:
89 case kGrowableArraySetIndexedUnchecked:
90 return kGrowableObjectArrayCid;
92#define TYPED_DATA_GET_SET_INDEXED_CASES(clazz) \
93 case k##clazz##ArrayGetIndexed: \
94 case k##clazz##ArraySetIndexed: \
95 return kTypedData##clazz##ArrayCid; \
96 case kExternal##clazz##ArrayGetIndexed: \
97 return kExternalTypedData##clazz##ArrayCid; \
98 case k##clazz##ArrayViewGetIndexed: \
99 return kTypedData##clazz##ArrayViewCid;
102#undef TYPED_DATA_GET_SET_INDEXED_CASES
104 case kExternalUint8ArraySetIndexed:
105 return kExternalTypedDataUint8ArrayCid;
107 case kExternalUint8ClampedArraySetIndexed:
108 return kExternalTypedDataUint8ClampedArrayCid;
123 {
"",
"",
"Unknown", 0},
124#define RECOGNIZE_METHOD(class_name, function_name, enum_name, fp) \
125 {"" #class_name, "" #function_name, #enum_name, fp},
127#undef RECOGNIZE_METHOD
146 function.IsDynamicInvocationForwarder()
152 Symbols::vm_recognized(),
false, &
options);
153 if (!is_recognized)
return false;
154 if (kind ==
nullptr)
return true;
160 return String::Cast(
options).Equals(kind);
167 bool fingerprints_match =
true;
179#define RECOGNIZE_METHOD(class_name, function_name, enum_name, fp) \
180 case MethodRecognizer::k##enum_name: \
181 func.reset_unboxed_parameters_and_return(); \
184#undef RECOGNIZE_METHOD
188 }
else if (!FLAG_precompiled_mode) {
189 fingerprints_match =
false;
195#define SET_FUNCTION_BIT(class_name, function_name, dest, fp, setter, value) \
196 func = Library::GetFunction(libs, #class_name, #function_name); \
197 if (!func.IsNull()) { \
198 fingerprints_match = \
199 func.CheckSourceFingerprint(fp) && fingerprints_match; \
200 func.setter(value); \
201 } else if (!FLAG_precompiled_mode) { \
202 OS::PrintErr("Missing %s::%s\n", #class_name, #function_name); \
203 fingerprints_match = false; \
206#define SET_IS_POLYMORPHIC_TARGET(class_name, function_name, dest, fp) \
207 SET_FUNCTION_BIT(class_name, function_name, dest, fp, \
208 set_is_polymorphic_target, true)
212#undef SET_RECOGNIZED_KIND
213#undef SET_IS_POLYMORPHIC_TARGET
214#undef SET_FUNCTION_BIT
216 if (!fingerprints_match) {
220 "FP mismatch while recognizing methods. If the behavior of "
221 "these functions has changed, then changes are also needed in "
222 "the VM's compiler. Otherwise the fingerprint can simply be "
223 "updated in recognized_methods_list.h\n");
250 }
else if (
name.ptr() == Symbols::TruncDivOperator().ptr()) {
251 return Token::kTRUNCDIV;
255 return Token::kBIT_OR;
257 return Token::kBIT_AND;
259 return Token::kBIT_XOR;
260 }
else if (
name.ptr() == Symbols::LeftShiftOperator().ptr()) {
262 }
else if (
name.ptr() == Symbols::RightShiftOperator().ptr()) {
264 }
else if (
name.ptr() == Symbols::UnsignedRightShiftOperator().ptr()) {
267 return Token::kBIT_NOT;
268 }
else if (
name.ptr() == Symbols::UnaryMinus().ptr()) {
269 return Token::kNEGATE;
270 }
else if (
name.ptr() == Symbols::EqualOperator().ptr()) {
278 }
else if (
name.ptr() == Symbols::LessEqualOperator().ptr()) {
280 }
else if (
name.ptr() == Symbols::GreaterEqualOperator().ptr()) {
287 return Token::kILLEGAL;
302#define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp) \
303 {Symbols::k##symbol##Id, cid, fp, #symbol ", " #cid},
313#undef RECOGNIZE_FACTORY
347 if (
function.name() == Symbols::ListFactory().ptr()) {
349 return (
argument_count == 1) ? kGrowableObjectArrayCid : kArrayCid;
350 }
else if (
function.name() == Symbols::ListFilledFactory().ptr()) {
SkIDChangeListener::List List
#define DART_CLASS_LIST_TYPED_DATA(V)
LibraryPtr library() const
static intptr_t ResultCid(const Function &factory)
static intptr_t GetResultCidOfListFactory(Zone *zone, const Function &function, intptr_t argument_count)
static bool IsGetterName(const String &function_name)
static bool IsSetterName(const String &function_name)
static bool IsDynamicInvocationForwarderName(const String &name)
static StringPtr DemangleDynamicInvocationForwarderName(const String &name)
bool CheckSourceFingerprint(int32_t fp, const char *kind=nullptr) const
void set_recognized_kind(MethodRecognizer::Kind value) const
static LibraryPtr CoreLibrary()
static LibraryPtr IsolateLibrary()
static LibraryPtr ConvertLibrary()
static LibraryPtr NativeWrappersLibrary()
static LibraryPtr CollectionLibrary()
static bool FindPragma(Thread *T, bool only_core, const Object &object, const String &pragma_name, bool multiple=false, Object *options=nullptr)
static LibraryPtr AsyncLibrary()
static LibraryPtr LookupLibrary(Thread *thread, const String &url)
static FunctionPtr GetFunction(const GrowableArray< Library * > &libs, const char *class_name, const char *function_name)
static LibraryPtr InternalLibrary()
static LibraryPtr FfiLibrary()
static LibraryPtr MathLibrary()
static LibraryPtr DeveloperLibrary()
static LibraryPtr TypedDataLibrary()
static intptr_t ResultCidFromPragma(const Object &function_or_field)
static bool IsMarkedAsRecognized(const Function &function, const char *kind=nullptr)
static intptr_t MethodKindToReceiverCid(Kind kind)
static void InitializeState()
static intptr_t NumArgsCheckedForStaticCall(const Function &function)
static const char * KindToCString(Kind kind)
static const char * KindToFunctionNameCString(Kind kind)
static Token::Kind RecognizeTokenKind(const String &name)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static Object & ZoneHandle()
static StringPtr SubString(const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
static bool EqualsIgnoringPrivateKey(const String &str1, const String &str2)
static const String & Percent()
static const String & Symbol(intptr_t index)
static const String & Plus()
static const String & LAngleBracket()
static const String & BitOr()
static const String & Caret()
static const String & Tilde()
static const String & RAngleBracket()
static const String & Ampersand()
static const String & Star()
static const String & Slash()
static const String & Minus()
static const String & Token(Token::Kind token)
static Thread * Current()
Dart_NativeFunction function
#define SET_IS_POLYMORPHIC_TARGET(class_name, function_name, dest, fp)
#define RECOGNIZE_METHOD(class_name, function_name, enum_name, fp)
#define TYPED_DATA_GET_SET_INDEXED_CASES(clazz)
#define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp)
static bool Equals(const Object &expected, const Object &actual)
static Token::Kind RecognizeTokenKindHelper(const String &name)
const char *const class_name
const uint32_t finger_print
static const struct dart::@132 recognized_methods[MethodRecognizer::kNumRecognizedMethods]
static const struct dart::@133 factory_recognizer_list[]
const char *const enum_name
const char *const function_name
#define ALL_INTRINSICS_LIST(V)
#define POLYMORPHIC_TARGET_LIST(V)
#define RECOGNIZED_LIST_FACTORY_LIST(V)
#define RECOGNIZED_LIST(V)