5#ifndef RUNTIME_VM_CANONICAL_TABLES_H_
6#define RUNTIME_VM_CANONICAL_TABLES_H_
14template <
typename CharType>
28 if (other.
Hash() != hash_) {
31 return other.
Equals(data_, len_);
36 const CharType* data_;
47 : str_(str), begin_index_(begin_index), len_(
length) {
53 if (other.
Hash() != hash_) {
56 return other.
Equals(str_, begin_index_, len_);
61 bool is_all()
const {
return begin_index_ == 0 && len_ == str_.
Length(); }
63 intptr_t begin_index_;
71 : str1_(str1), str2_(str2), hash_(
String::HashConcat(str1, str2)) {}
75 if (other.
Hash() != hash_) {
90 static const char*
Name() {
return "SymbolTraits"; }
94 const String& a_str = String::Cast(
a);
95 const String& b_str = String::Cast(
b);
101 intptr_t a_len = a_str.
Length();
102 if (a_len != b_str.
Length()) {
106 return a_str.
Equals(b_str, 0, a_len);
108 template <
typename CharType>
110 return array.
Equals(String::Cast(obj));
113 return slice.
Equals(String::Cast(obj));
116 return concat.
Equals(String::Cast(obj));
119 template <
typename CharType>
125 template <
typename CharType>
135typedef UnorderedHashSet<SymbolTraits, WeakAcqRelStorageTraits>
146 DISALLOW_ALLOCATION();
152 static const char*
Name() {
return "CanonicalTypeTraits"; }
158 const Type& arg1 = Type::Cast(
a);
159 const Type& arg2 = Type::Cast(
b);
164 return a.Matches(Type::Cast(
b));
168 return Type::Cast(
key).Hash();
185 DISALLOW_ALLOCATION();
191 static const char*
Name() {
return "CanonicalFunctionTypeTraits"; }
196 ASSERT(
a.IsFunctionType() &&
b.IsFunctionType());
203 return a.Matches(FunctionType::Cast(
b));
207 return FunctionType::Cast(
key).Hash();
224 DISALLOW_ALLOCATION();
230 static const char*
Name() {
return "CanonicalRecordTypeTraits"; }
235 ASSERT(
a.IsRecordType() &&
b.IsRecordType());
242 return a.Matches(RecordType::Cast(
b));
246 return RecordType::Cast(
key).Hash();
263 DISALLOW_ALLOCATION();
269 static const char*
Name() {
return "CanonicalTypeParameterTraits"; }
274 ASSERT(
a.IsTypeParameter() &&
b.IsTypeParameter());
281 return a.Matches(TypeParameter::Cast(
b));
285 return TypeParameter::Cast(
key).Hash();
292typedef UnorderedHashSet<CanonicalTypeParameterTraits>
305 DISALLOW_ALLOCATION();
311 static const char*
Name() {
return "CanonicalTypeArgumentsTraits"; }
316 ASSERT(
a.IsTypeArguments() &&
b.IsTypeArguments());
323 return a.Matches(TypeArguments::Cast(
b));
327 return TypeArguments::Cast(
key).Hash();
334typedef UnorderedHashSet<CanonicalTypeArgumentsTraits>
339 static const char*
Name() {
return "MetadataMapTraits"; }
349 const Array& args_desc,
351 : name_(
name), args_desc_(args_desc), kind_(kind) {}
353 return (name_.
ptr() == other.
name()) &&
355 (kind_ == other.
kind());
361 const Array& args_desc_;
367 static const char*
Name() {
return "DispatcherTraits"; }
372 const Function& a_func = Function::Cast(
a);
373 const Function& b_func = Function::Cast(
b);
374 return (a_func.
name() == b_func.
name()) &&
379 return key.Equals(Function::Cast(obj));
399 DISALLOW_ALLOCATION();
405 static const char*
Name() {
return "CanonicalInstanceTraits"; }
420 static const char*
Name() {
return "CanonicalFfiCallbackFunctionTraits"; }
422 const auto& f1 = Function::Cast(
x);
423 const auto& f2 = Function::Cast(
y);
424 return (f1.FfiCallbackTarget() == f2.FfiCallbackTarget() &&
425 f1.FfiCSignature() == f2.FfiCSignature() &&
426 f1.FfiCallbackExceptionalReturn() ==
427 f2.FfiCallbackExceptionalReturn() &&
428 f1.GetFfiCallbackKind() == f2.GetFfiCallbackKind());
454 DISALLOW_ALLOCATION();
459 static const char*
Name() {
return "CanonicalRegExpTraits"; }
462 return RegExp::Cast(
a).CanonicalizeEquals(RegExp::Cast(
b));
465 return a.Equals(RegExp::Cast(
b));
468 return RegExp::Cast(
key).CanonicalizeHash();
474typedef UnorderedHashSet<CanonicalRegExpTraits, WeakAcqRelStorageTraits>
virtual bool Equals(const Instance &other) const
bool Matches(const FunctionType &arg) const
CanonicalFunctionTypeKey(const FunctionType &key)
const FunctionType & key_
static uword Hash(const Object &key)
static const char * Name()
static bool IsMatch(const Object &a, const Object &b)
static ObjectPtr NewKey(const CanonicalFunctionTypeKey &obj)
static uword Hash(const CanonicalFunctionTypeKey &key)
static bool ReportStats()
static bool IsMatch(const CanonicalFunctionTypeKey &a, const Object &b)
CanonicalInstanceKey(const Instance &key)
bool Matches(const Instance &obj) const
static bool IsMatch(const Object &a, const Object &b)
static ObjectPtr NewKey(const CanonicalInstanceKey &obj)
static const char * Name()
static bool ReportStats()
static uword Hash(const Object &key)
CanonicalRecordTypeKey(const RecordType &key)
bool Matches(const RecordType &arg) const
static bool IsMatch(const Object &a, const Object &b)
static uword Hash(const Object &key)
static bool ReportStats()
static uword Hash(const CanonicalRecordTypeKey &key)
static ObjectPtr NewKey(const CanonicalRecordTypeKey &obj)
static bool IsMatch(const CanonicalRecordTypeKey &a, const Object &b)
static const char * Name()
static bool IsMatch(const Object &a, const Object &b)
static uword Hash(const RegExpKey &key)
static bool IsMatch(const RegExpKey &a, const Object &b)
static const char * Name()
static bool ReportStats()
static ObjectPtr NewKey(const RegExpKey &key)
static uword Hash(const Object &key)
const TypeArguments & key_
bool Matches(const TypeArguments &arg) const
CanonicalTypeArgumentsKey(const TypeArguments &key)
static uword Hash(const CanonicalTypeArgumentsKey &key)
static const char * Name()
static bool IsMatch(const CanonicalTypeArgumentsKey &a, const Object &b)
static bool IsMatch(const Object &a, const Object &b)
static ObjectPtr NewKey(const CanonicalTypeArgumentsKey &obj)
static uword Hash(const Object &key)
static bool ReportStats()
CanonicalTypeKey(const Type &key)
bool Matches(const Type &arg) const
CanonicalTypeParameterKey(const TypeParameter &key)
const TypeParameter & key_
bool Matches(const TypeParameter &arg) const
static ObjectPtr NewKey(const CanonicalTypeParameterKey &obj)
static uword Hash(const Object &key)
static bool IsMatch(const CanonicalTypeParameterKey &a, const Object &b)
static uword Hash(const CanonicalTypeParameterKey &key)
static const char * Name()
static bool ReportStats()
static bool IsMatch(const Object &a, const Object &b)
static ObjectPtr NewKey(const CanonicalTypeKey &obj)
static bool IsMatch(const CanonicalTypeKey &a, const Object &b)
static bool IsMatch(const Object &a, const Object &b)
static const char * Name()
static bool ReportStats()
static uword Hash(const Object &key)
static uword Hash(const CanonicalTypeKey &key)
StringPtr ToSymbol() const
CharArray(const CharType *data, intptr_t len)
bool Equals(const String &other) const
bool Equals(const String &other) const
StringPtr ToSymbol() const
ConcatString(const String &str1, const String &str2)
DispatcherKey(const String &name, const Array &args_desc, UntaggedFunction::Kind kind)
bool Equals(const Function &other) const
static uword Hash(const DispatcherKey &key)
static bool ReportStats()
static const char * Name()
static bool IsMatch(const DispatcherKey &key, const Object &obj)
static bool IsMatch(const Object &a, const Object &b)
static ObjectPtr NewKey(const DispatcherKey &key)
static uword Hash(const Object &key)
UntaggedFunction::Kind kind() const
ArrayPtr saved_args_desc() const
bool Equals(const RegExp &other) const
RegExpKey(const String &pattern, RegExpFlags flags)
StringPtr pattern() const
RegExpFlags flags() const
bool Equals(const String &other) const
StringPtr ToSymbol() const
StringSlice(const String &str, intptr_t begin_index, intptr_t length)
bool Equals(const String &str) const
bool EqualsConcat(const String &str1, const String &str2) const
static uword Hash(const ConcatString &concat)
static ObjectPtr NewKey(const CharArray< CharType > &array)
static const char * Name()
static ObjectPtr NewKey(const ConcatString &concat)
static uword Hash(const StringSlice &slice)
static uword Hash(const Object &key)
static ObjectPtr NewKey(const StringSlice &slice)
static bool ReportStats()
static uword Hash(const CharArray< CharType > &array)
static bool IsMatch(const StringSlice &slice, const Object &obj)
static bool IsMatch(const ConcatString &concat, const Object &obj)
static bool IsMatch(const Object &a, const Object &b)
static bool IsMatch(const CharArray< CharType > &array, const Object &obj)
bool Equals(const TypeArguments &other) const
FlutterSemanticsFlag flags
UnorderedHashSet< CanonicalFunctionTypeTraits > CanonicalFunctionTypeSet
UnorderedHashSet< CanonicalRegExpTraits, WeakAcqRelStorageTraits > CanonicalRegExpSet
UnorderedHashSet< CanonicalTypeArgumentsTraits > CanonicalTypeArgumentsSet
UnorderedHashSet< CanonicalTypeParameterTraits > CanonicalTypeParameterSet
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
CharArray< uint8_t > Latin1Array
UnorderedHashSet< CanonicalInstanceTraits > CanonicalInstancesSet
CharArray< uint16_t > UTF16Array
UnorderedHashSet< CanonicalTypeTraits > CanonicalTypeSet
StringPtr StringFrom(const uint8_t *data, intptr_t len, Heap::Space space)
CharArray< int32_t > UTF32Array
UnorderedHashSet< DispatcherTraits, AcqRelStorageTraits > DispatcherSet
UnorderedHashMap< MetadataMapTraits > MetadataMap
static int8_t data[kExtLength]
UnorderedHashSet< SymbolTraits, WeakAcqRelStorageTraits > CanonicalStringSet
UnorderedHashSet< CanonicalRecordTypeTraits > CanonicalRecordTypeSet
static bool IsMatch(const Object &x, const Object &y)
static const char * Name()
static uint32_t Hash(const Object &key)
static bool ReportStats()