Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 765c2ec1424eb0fb79ffb7f3ff0d6aa678848eb1..e7f5e66f55d0ef7489eba3fddeed5bd2252af568 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -1401,8 +1401,11 @@ Object* Object::GetHash() { |
Object* hash = GetSimpleHash(); |
if (hash->IsSmi()) return hash; |
+ DisallowHeapAllocation no_gc; |
DCHECK(IsJSReceiver()); |
- return JSReceiver::cast(this)->GetIdentityHash(); |
+ JSReceiver* receiver = JSReceiver::cast(this); |
+ Isolate* isolate = receiver->GetIsolate(); |
+ return *JSReceiver::GetIdentityHash(isolate, handle(receiver, isolate)); |
} |
@@ -5855,7 +5858,7 @@ static Smi* GenerateIdentityHash(Isolate* isolate) { |
void JSObject::SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash) { |
DCHECK(!object->IsJSGlobalProxy()); |
Isolate* isolate = object->GetIsolate(); |
- Handle<Name> hash_code_symbol(isolate->heap()->hash_code_symbol()); |
+ Handle<Name> hash_code_symbol = isolate->factory()->hash_code_symbol(); |
JSObject::AddProperty(object, hash_code_symbol, hash, NONE); |
} |
@@ -5872,40 +5875,35 @@ static Handle<Smi> GetOrCreateIdentityHashHelper(Handle<ProxyType> proxy) { |
return hash; |
} |
- |
-Object* JSObject::GetIdentityHash() { |
- DisallowHeapAllocation no_gc; |
- Isolate* isolate = GetIsolate(); |
- if (IsJSGlobalProxy()) { |
- return JSGlobalProxy::cast(this)->hash(); |
+// static |
+Handle<Object> JSObject::GetIdentityHash(Isolate* isolate, |
+ Handle<JSObject> object) { |
+ if (object->IsJSGlobalProxy()) { |
+ return handle(JSGlobalProxy::cast(*object)->hash(), isolate); |
} |
- Handle<Name> hash_code_symbol(isolate->heap()->hash_code_symbol()); |
- Handle<Object> stored_value = |
- Object::GetPropertyOrElement(Handle<Object>(this, isolate), |
- hash_code_symbol).ToHandleChecked(); |
- return stored_value->IsSmi() ? *stored_value |
- : isolate->heap()->undefined_value(); |
+ Handle<Name> hash_code_symbol = isolate->factory()->hash_code_symbol(); |
+ return JSReceiver::GetDataProperty(object, hash_code_symbol); |
} |
- |
+// static |
Handle<Smi> JSObject::GetOrCreateIdentityHash(Handle<JSObject> object) { |
if (object->IsJSGlobalProxy()) { |
return GetOrCreateIdentityHashHelper(Handle<JSGlobalProxy>::cast(object)); |
} |
Isolate* isolate = object->GetIsolate(); |
- Handle<Object> maybe_hash(object->GetIdentityHash(), isolate); |
+ Handle<Object> maybe_hash = JSObject::GetIdentityHash(isolate, object); |
if (maybe_hash->IsSmi()) return Handle<Smi>::cast(maybe_hash); |
Handle<Smi> hash(GenerateIdentityHash(isolate), isolate); |
- Handle<Name> hash_code_symbol(isolate->heap()->hash_code_symbol()); |
- JSObject::AddProperty(object, hash_code_symbol, hash, NONE); |
+ SetIdentityHash(object, hash); |
return hash; |
} |
- |
-Object* JSProxy::GetIdentityHash() { |
- return this->hash(); |
+// static |
+Handle<Object> JSProxy::GetIdentityHash(Isolate* isolate, |
+ Handle<JSProxy> proxy) { |
+ return handle(proxy->hash(), isolate); |
} |