@@ -2319,6 +2319,7 @@ namespace {
23192319// objects. This avoids a double lookup in the cases where we know we will
23202320// add the hash to the JSObject if it does not already exist.
23212321Object* GetSimpleHash(Object* object) {
2322+ DisallowHeapAllocation no_gc;
23222323 // The object is either a Smi, a HeapNumber, a name, an odd-ball, a real JS
23232324 // object, or a Harmony proxy.
23242325 if (object->IsSmi()) {
@@ -2351,10 +2352,10 @@ Object* GetSimpleHash(Object* object) {
23512352} // namespace
23522353
23532354Object* Object::GetHash() {
2355+ DisallowHeapAllocation no_gc;
23542356 Object* hash = GetSimpleHash(this);
23552357 if (hash->IsSmi()) return hash;
23562358
2357- DisallowHeapAllocation no_gc;
23582359 DCHECK(IsJSReceiver());
23592360 JSReceiver* receiver = JSReceiver::cast(this);
23602361 Isolate* isolate = receiver->GetIsolate();
@@ -2363,10 +2364,12 @@ Object* Object::GetHash() {
23632364
23642365// static
23652366Smi* Object::GetOrCreateHash(Isolate* isolate, Object* key) {
2367+ DisallowHeapAllocation no_gc;
23662368 return key->GetOrCreateHash(isolate);
23672369}
23682370
23692371Smi* Object::GetOrCreateHash(Isolate* isolate) {
2372+ DisallowHeapAllocation no_gc;
23702373 Object* hash = GetSimpleHash(this);
23712374 if (hash->IsSmi()) return Smi::cast(hash);
23722375
@@ -6283,6 +6286,7 @@ Object* SetHashAndUpdateProperties(HeapObject* properties, int masked_hash) {
62836286}
62846287
62856288int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
6289+ DisallowHeapAllocation no_gc;
62866290 Object* properties = object->raw_properties_or_hash();
62876291 if (properties->IsSmi()) {
62886292 return Smi::ToInt(properties);
@@ -6309,6 +6313,7 @@ int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
63096313} // namespace
63106314
63116315void JSReceiver::SetIdentityHash(int masked_hash) {
6316+ DisallowHeapAllocation no_gc;
63126317 DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash);
63136318 DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash);
63146319
@@ -6319,6 +6324,7 @@ void JSReceiver::SetIdentityHash(int masked_hash) {
63196324}
63206325
63216326void JSReceiver::SetProperties(HeapObject* properties) {
6327+ DisallowHeapAllocation no_gc;
63226328 Isolate* isolate = properties->GetIsolate();
63236329 int hash = GetIdentityHashHelper(isolate, this);
63246330 Object* new_properties = properties;
@@ -6334,6 +6340,7 @@ void JSReceiver::SetProperties(HeapObject* properties) {
63346340
63356341template <typename ProxyType>
63366342Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
6343+ DisallowHeapAllocation no_gc;
63376344 Object* maybe_hash = proxy->hash();
63386345 if (maybe_hash->IsSmi()) return Smi::cast(maybe_hash);
63396346
@@ -6343,6 +6350,7 @@ Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
63436350}
63446351
63456352Object* JSObject::GetIdentityHash(Isolate* isolate) {
6353+ DisallowHeapAllocation no_gc;
63466354 if (IsJSGlobalProxy()) {
63476355 return JSGlobalProxy::cast(this)->hash();
63486356 }
@@ -6356,6 +6364,7 @@ Object* JSObject::GetIdentityHash(Isolate* isolate) {
63566364}
63576365
63586366Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) {
6367+ DisallowHeapAllocation no_gc;
63596368 if (IsJSGlobalProxy()) {
63606369 return GetOrCreateIdentityHashHelper(isolate, JSGlobalProxy::cast(this));
63616370 }
0 commit comments