@@ -2301,6 +2301,7 @@ namespace {
2301
2301
// objects. This avoids a double lookup in the cases where we know we will
2302
2302
// add the hash to the JSObject if it does not already exist.
2303
2303
Object* GetSimpleHash(Object* object) {
2304
+ DisallowHeapAllocation no_gc;
2304
2305
// The object is either a Smi, a HeapNumber, a name, an odd-ball, a real JS
2305
2306
// object, or a Harmony proxy.
2306
2307
if (object->IsSmi()) {
@@ -2333,10 +2334,10 @@ Object* GetSimpleHash(Object* object) {
2333
2334
} // namespace
2334
2335
2335
2336
Object* Object::GetHash() {
2337
+ DisallowHeapAllocation no_gc;
2336
2338
Object* hash = GetSimpleHash(this);
2337
2339
if (hash->IsSmi()) return hash;
2338
2340
2339
- DisallowHeapAllocation no_gc;
2340
2341
DCHECK(IsJSReceiver());
2341
2342
JSReceiver* receiver = JSReceiver::cast(this);
2342
2343
Isolate* isolate = receiver->GetIsolate();
@@ -2345,10 +2346,12 @@ Object* Object::GetHash() {
2345
2346
2346
2347
// static
2347
2348
Smi* Object::GetOrCreateHash(Isolate* isolate, Object* key) {
2349
+ DisallowHeapAllocation no_gc;
2348
2350
return key->GetOrCreateHash(isolate);
2349
2351
}
2350
2352
2351
2353
Smi* Object::GetOrCreateHash(Isolate* isolate) {
2354
+ DisallowHeapAllocation no_gc;
2352
2355
Object* hash = GetSimpleHash(this);
2353
2356
if (hash->IsSmi()) return Smi::cast(hash);
2354
2357
@@ -6286,6 +6289,7 @@ Object* SetHashAndUpdateProperties(HeapObject* properties, int masked_hash) {
6286
6289
}
6287
6290
6288
6291
int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
6292
+ DisallowHeapAllocation no_gc;
6289
6293
Object* properties = object->raw_properties_or_hash();
6290
6294
if (properties->IsSmi()) {
6291
6295
return Smi::ToInt(properties);
@@ -6312,6 +6316,7 @@ int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
6312
6316
} // namespace
6313
6317
6314
6318
void JSReceiver::SetIdentityHash(int masked_hash) {
6319
+ DisallowHeapAllocation no_gc;
6315
6320
DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash);
6316
6321
DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash);
6317
6322
@@ -6322,6 +6327,7 @@ void JSReceiver::SetIdentityHash(int masked_hash) {
6322
6327
}
6323
6328
6324
6329
void JSReceiver::SetProperties(HeapObject* properties) {
6330
+ DisallowHeapAllocation no_gc;
6325
6331
Isolate* isolate = properties->GetIsolate();
6326
6332
int hash = GetIdentityHashHelper(isolate, this);
6327
6333
Object* new_properties = properties;
@@ -6337,6 +6343,7 @@ void JSReceiver::SetProperties(HeapObject* properties) {
6337
6343
6338
6344
template <typename ProxyType>
6339
6345
Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
6346
+ DisallowHeapAllocation no_gc;
6340
6347
Object* maybe_hash = proxy->hash();
6341
6348
if (maybe_hash->IsSmi()) return Smi::cast(maybe_hash);
6342
6349
@@ -6346,6 +6353,7 @@ Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
6346
6353
}
6347
6354
6348
6355
Object* JSObject::GetIdentityHash(Isolate* isolate) {
6356
+ DisallowHeapAllocation no_gc;
6349
6357
if (IsJSGlobalProxy()) {
6350
6358
return JSGlobalProxy::cast(this)->hash();
6351
6359
}
@@ -6359,6 +6367,7 @@ Object* JSObject::GetIdentityHash(Isolate* isolate) {
6359
6367
}
6360
6368
6361
6369
Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) {
6370
+ DisallowHeapAllocation no_gc;
6362
6371
if (IsJSGlobalProxy()) {
6363
6372
return GetOrCreateIdentityHashHelper(isolate, JSGlobalProxy::cast(this));
6364
6373
}
0 commit comments