Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
dart::DefaultHashTraits Class Reference

Static Public Member Functions

static const char * Name ()
 
static bool ReportStats ()
 
static bool IsMatch (const Object &a, const Object &b)
 
static uword Hash (const Object &obj)
 

Detailed Description

Definition at line 25056 of file object.cc.

Member Function Documentation

◆ Hash()

static uword dart::DefaultHashTraits::Hash ( const Object obj)
inlinestatic

Definition at line 25068 of file object.cc.

25068 {
25069 if (obj.IsNull()) {
25070 return 0;
25071 }
25072 // TODO(koda): Ensure VM classes only produce Smi hash codes, and remove
25073 // non-Smi cases once Dart-side implementation is complete.
25074 Thread* thread = Thread::Current();
25076 Instance& hash_code = thread->InstanceHandle();
25077 hash_code ^= Instance::Cast(obj).HashCode();
25078 if (hash_code.IsSmi()) {
25079 // May waste some bits on 64-bit, to ensure consistency with non-Smi case.
25080 return static_cast<uword>(Smi::Cast(hash_code).AsTruncatedUint32Value());
25081 } else if (hash_code.IsInteger()) {
25082 return static_cast<uword>(
25083 Integer::Cast(hash_code).AsTruncatedUint32Value());
25084 } else {
25085 return 0;
25086 }
25087 }
static Thread * Current()
Definition: thread.h:362
uintptr_t uword
Definition: globals.h:501
#define REUSABLE_INSTANCE_HANDLESCOPE(thread)

◆ IsMatch()

static bool dart::DefaultHashTraits::IsMatch ( const Object a,
const Object b 
)
inlinestatic

Definition at line 25061 of file object.cc.

25061 {
25062 if (a.IsNull() || b.IsNull()) {
25063 return (a.IsNull() && b.IsNull());
25064 } else {
25065 return Instance::Cast(a).OperatorEquals(Instance::Cast(b));
25066 }
25067 }
static bool b
struct MyStruct a[10]

◆ Name()

static const char * dart::DefaultHashTraits::Name ( )
inlinestatic

Definition at line 25058 of file object.cc.

25058{ return "DefaultHashTraits"; }

◆ ReportStats()

static bool dart::DefaultHashTraits::ReportStats ( )
inlinestatic

Definition at line 25059 of file object.cc.

25059{ return false; }

The documentation for this class was generated from the following file: