Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 25135 of file object.cc.

Member Function Documentation

◆ Hash()

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

Definition at line 25147 of file object.cc.

25147 {
25148 if (obj.IsNull()) {
25149 return 0;
25150 }
25151 // TODO(koda): Ensure VM classes only produce Smi hash codes, and remove
25152 // non-Smi cases once Dart-side implementation is complete.
25153 Thread* thread = Thread::Current();
25155 Instance& hash_code = thread->InstanceHandle();
25156 hash_code ^= Instance::Cast(obj).HashCode();
25157 if (hash_code.IsSmi()) {
25158 // May waste some bits on 64-bit, to ensure consistency with non-Smi case.
25159 return static_cast<uword>(Smi::Cast(hash_code).AsTruncatedUint32Value());
25160 } else if (hash_code.IsInteger()) {
25161 return static_cast<uword>(
25162 Integer::Cast(hash_code).AsTruncatedUint32Value());
25163 } else {
25164 return 0;
25165 }
25166 }
static Thread * Current()
Definition thread.h:361
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 25140 of file object.cc.

25140 {
25141 if (a.IsNull() || b.IsNull()) {
25142 return (a.IsNull() && b.IsNull());
25143 } else {
25144 return Instance::Cast(a).OperatorEquals(Instance::Cast(b));
25145 }
25146 }
static bool b
struct MyStruct a[10]

◆ Name()

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

Definition at line 25137 of file object.cc.

25137{ return "DefaultHashTraits"; }

◆ ReportStats()

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

Definition at line 25138 of file object.cc.

25138{ return false; }

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