Commit 7abdadca authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

Sprinkle some DisallowHeapAllocation

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I7d34ccddeea08f5935e360e8c36791365f27f89e
Reviewed-on: https://chromium-review.googlesource.com/647706Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47804}
parent 36d70377
...@@ -5267,6 +5267,7 @@ Local<v8::Context> v8::Object::CreationContext() { ...@@ -5267,6 +5267,7 @@ Local<v8::Context> v8::Object::CreationContext() {
int v8::Object::GetIdentityHash() { int v8::Object::GetIdentityHash() {
i::DisallowHeapAllocation no_gc;
auto isolate = Utils::OpenHandle(this)->GetIsolate(); auto isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
auto self = Utils::OpenHandle(this); auto self = Utils::OpenHandle(this);
......
...@@ -2319,6 +2319,7 @@ namespace { ...@@ -2319,6 +2319,7 @@ namespace {
// objects. This avoids a double lookup in the cases where we know we will // objects. This avoids a double lookup in the cases where we know we will
// add the hash to the JSObject if it does not already exist. // add the hash to the JSObject if it does not already exist.
Object* GetSimpleHash(Object* object) { Object* GetSimpleHash(Object* object) {
DisallowHeapAllocation no_gc;
// The object is either a Smi, a HeapNumber, a name, an odd-ball, a real JS // The object is either a Smi, a HeapNumber, a name, an odd-ball, a real JS
// object, or a Harmony proxy. // object, or a Harmony proxy.
if (object->IsSmi()) { if (object->IsSmi()) {
...@@ -2351,10 +2352,10 @@ Object* GetSimpleHash(Object* object) { ...@@ -2351,10 +2352,10 @@ Object* GetSimpleHash(Object* object) {
} // namespace } // namespace
Object* Object::GetHash() { Object* Object::GetHash() {
DisallowHeapAllocation no_gc;
Object* hash = GetSimpleHash(this); Object* hash = GetSimpleHash(this);
if (hash->IsSmi()) return hash; if (hash->IsSmi()) return hash;
DisallowHeapAllocation no_gc;
DCHECK(IsJSReceiver()); DCHECK(IsJSReceiver());
JSReceiver* receiver = JSReceiver::cast(this); JSReceiver* receiver = JSReceiver::cast(this);
Isolate* isolate = receiver->GetIsolate(); Isolate* isolate = receiver->GetIsolate();
...@@ -2363,10 +2364,12 @@ Object* Object::GetHash() { ...@@ -2363,10 +2364,12 @@ Object* Object::GetHash() {
// static // static
Smi* Object::GetOrCreateHash(Isolate* isolate, Object* key) { Smi* Object::GetOrCreateHash(Isolate* isolate, Object* key) {
DisallowHeapAllocation no_gc;
return key->GetOrCreateHash(isolate); return key->GetOrCreateHash(isolate);
} }
Smi* Object::GetOrCreateHash(Isolate* isolate) { Smi* Object::GetOrCreateHash(Isolate* isolate) {
DisallowHeapAllocation no_gc;
Object* hash = GetSimpleHash(this); Object* hash = GetSimpleHash(this);
if (hash->IsSmi()) return Smi::cast(hash); if (hash->IsSmi()) return Smi::cast(hash);
...@@ -6283,6 +6286,7 @@ Object* SetHashAndUpdateProperties(HeapObject* properties, int masked_hash) { ...@@ -6283,6 +6286,7 @@ Object* SetHashAndUpdateProperties(HeapObject* properties, int masked_hash) {
} }
int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) { int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
DisallowHeapAllocation no_gc;
Object* properties = object->raw_properties_or_hash(); Object* properties = object->raw_properties_or_hash();
if (properties->IsSmi()) { if (properties->IsSmi()) {
return Smi::ToInt(properties); return Smi::ToInt(properties);
...@@ -6309,6 +6313,7 @@ int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) { ...@@ -6309,6 +6313,7 @@ int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
} // namespace } // namespace
void JSReceiver::SetIdentityHash(int masked_hash) { void JSReceiver::SetIdentityHash(int masked_hash) {
DisallowHeapAllocation no_gc;
DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash); DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash);
DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash); DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash);
...@@ -6319,6 +6324,7 @@ void JSReceiver::SetIdentityHash(int masked_hash) { ...@@ -6319,6 +6324,7 @@ void JSReceiver::SetIdentityHash(int masked_hash) {
} }
void JSReceiver::SetProperties(HeapObject* properties) { void JSReceiver::SetProperties(HeapObject* properties) {
DisallowHeapAllocation no_gc;
Isolate* isolate = properties->GetIsolate(); Isolate* isolate = properties->GetIsolate();
int hash = GetIdentityHashHelper(isolate, this); int hash = GetIdentityHashHelper(isolate, this);
Object* new_properties = properties; Object* new_properties = properties;
...@@ -6334,6 +6340,7 @@ void JSReceiver::SetProperties(HeapObject* properties) { ...@@ -6334,6 +6340,7 @@ void JSReceiver::SetProperties(HeapObject* properties) {
template <typename ProxyType> template <typename ProxyType>
Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) { Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
DisallowHeapAllocation no_gc;
Object* maybe_hash = proxy->hash(); Object* maybe_hash = proxy->hash();
if (maybe_hash->IsSmi()) return Smi::cast(maybe_hash); if (maybe_hash->IsSmi()) return Smi::cast(maybe_hash);
...@@ -6343,6 +6350,7 @@ Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) { ...@@ -6343,6 +6350,7 @@ Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
} }
Object* JSObject::GetIdentityHash(Isolate* isolate) { Object* JSObject::GetIdentityHash(Isolate* isolate) {
DisallowHeapAllocation no_gc;
if (IsJSGlobalProxy()) { if (IsJSGlobalProxy()) {
return JSGlobalProxy::cast(this)->hash(); return JSGlobalProxy::cast(this)->hash();
} }
...@@ -6356,6 +6364,7 @@ Object* JSObject::GetIdentityHash(Isolate* isolate) { ...@@ -6356,6 +6364,7 @@ Object* JSObject::GetIdentityHash(Isolate* isolate) {
} }
Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) { Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) {
DisallowHeapAllocation no_gc;
if (IsJSGlobalProxy()) { if (IsJSGlobalProxy()) {
return GetOrCreateIdentityHashHelper(isolate, JSGlobalProxy::cast(this)); return GetOrCreateIdentityHashHelper(isolate, JSGlobalProxy::cast(this));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment