| Index: runtime/lib/object.cc
|
| diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
|
| index c6490c76f71de81de2bdccae094491046d1ddaa1..c4f407f5dff923623eec09e62741ac870f844ab6 100644
|
| --- a/runtime/lib/object.cc
|
| +++ b/runtime/lib/object.cc
|
| @@ -42,17 +42,25 @@ DEFINE_NATIVE_ENTRY(Object_getHash, 1) {
|
| // Please note that no handle is created for the argument.
|
| // This is safe since the argument is only used in a tail call.
|
| // The performance benefit is more than 5% when using hashCode.
|
| +#if defined(HASH_IN_OBJECT_HEADER)
|
| + return Smi::New(Object::GetCachedHash(arguments->NativeArgAt(0)));
|
| +#else
|
| Heap* heap = isolate->heap();
|
| ASSERT(arguments->NativeArgAt(0)->IsDartInstance());
|
| return Smi::New(heap->GetHash(arguments->NativeArgAt(0)));
|
| +#endif
|
| }
|
|
|
|
|
| DEFINE_NATIVE_ENTRY(Object_setHash, 2) {
|
| - const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
|
| GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1));
|
| +#if defined(HASH_IN_OBJECT_HEADER)
|
| + Object::SetCachedHash(arguments->NativeArgAt(0), hash.Value());
|
| +#else
|
| + const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
|
| Heap* heap = isolate->heap();
|
| heap->SetHash(instance.raw(), hash.Value());
|
| +#endif
|
| return Object::null();
|
| }
|
|
|
|
|