Skip to content

Commit 7abdadc

Browse files
camillobruniCommit Bot
authored andcommitted
Sprinkle some DisallowHeapAllocation
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I7d34ccddeea08f5935e360e8c36791365f27f89e Reviewed-on: https://chromium-review.googlesource.com/647706 Reviewed-by: Michael Lippautz <[email protected]> Commit-Queue: Camillo Bruni <[email protected]> Cr-Commit-Position: refs/heads/master@{#47804}
1 parent 36d7037 commit 7abdadc

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/api.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5267,6 +5267,7 @@ Local<v8::Context> v8::Object::CreationContext() {
52675267

52685268

52695269
int v8::Object::GetIdentityHash() {
5270+
i::DisallowHeapAllocation no_gc;
52705271
auto isolate = Utils::OpenHandle(this)->GetIsolate();
52715272
i::HandleScope scope(isolate);
52725273
auto self = Utils::OpenHandle(this);

src/objects.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.
23212321
Object* 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

23532354
Object* 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
23652366
Smi* Object::GetOrCreateHash(Isolate* isolate, Object* key) {
2367+
DisallowHeapAllocation no_gc;
23662368
return key->GetOrCreateHash(isolate);
23672369
}
23682370

23692371
Smi* 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

62856288
int 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

63116315
void 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

63216326
void 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

63356341
template <typename ProxyType>
63366342
Smi* 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

63456352
Object* 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

63586366
Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) {
6367+
DisallowHeapAllocation no_gc;
63596368
if (IsJSGlobalProxy()) {
63606369
return GetOrCreateIdentityHashHelper(isolate, JSGlobalProxy::cast(this));
63616370
}

0 commit comments

Comments
 (0)