Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
deps: cherry-pick 7abdadc from upstream V8
Original commit message:

    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 <mlippautz@chromium.org>
    Commit-Queue: Camillo Bruni <cbruni@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#47804}

Refs: v8/v8@7abdadc
  • Loading branch information
targos committed Apr 3, 2018
commit da4047a683c34913c52213203617a2c221d3de4c
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.24',
'v8_embedder_string': '-node.25',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5244,6 +5244,7 @@ Local<v8::Context> v8::Object::CreationContext() {


int v8::Object::GetIdentityHash() {
i::DisallowHeapAllocation no_gc;
auto isolate = Utils::OpenHandle(this)->GetIsolate();
i::HandleScope scope(isolate);
auto self = Utils::OpenHandle(this);
Expand Down
11 changes: 10 additions & 1 deletion deps/v8/src/objects.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2301,6 +2301,7 @@ namespace {
// 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.
Object* GetSimpleHash(Object* object) {
DisallowHeapAllocation no_gc;
// The object is either a Smi, a HeapNumber, a name, an odd-ball, a real JS
// object, or a Harmony proxy.
if (object->IsSmi()) {
Expand Down Expand Up @@ -2333,10 +2334,10 @@ Object* GetSimpleHash(Object* object) {
} // namespace

Object* Object::GetHash() {
DisallowHeapAllocation no_gc;
Object* hash = GetSimpleHash(this);
if (hash->IsSmi()) return hash;

DisallowHeapAllocation no_gc;
DCHECK(IsJSReceiver());
JSReceiver* receiver = JSReceiver::cast(this);
Isolate* isolate = receiver->GetIsolate();
Expand All @@ -2345,10 +2346,12 @@ Object* Object::GetHash() {

// static
Smi* Object::GetOrCreateHash(Isolate* isolate, Object* key) {
DisallowHeapAllocation no_gc;
return key->GetOrCreateHash(isolate);
}

Smi* Object::GetOrCreateHash(Isolate* isolate) {
DisallowHeapAllocation no_gc;
Object* hash = GetSimpleHash(this);
if (hash->IsSmi()) return Smi::cast(hash);

Expand Down Expand Up @@ -6286,6 +6289,7 @@ Object* SetHashAndUpdateProperties(HeapObject* properties, int masked_hash) {
}

int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
DisallowHeapAllocation no_gc;
Object* properties = object->raw_properties_or_hash();
if (properties->IsSmi()) {
return Smi::ToInt(properties);
Expand All @@ -6312,6 +6316,7 @@ int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) {
} // namespace

void JSReceiver::SetIdentityHash(int masked_hash) {
DisallowHeapAllocation no_gc;
DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash);
DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash);

Expand All @@ -6322,6 +6327,7 @@ void JSReceiver::SetIdentityHash(int masked_hash) {
}

void JSReceiver::SetProperties(HeapObject* properties) {
DisallowHeapAllocation no_gc;
Isolate* isolate = properties->GetIsolate();
int hash = GetIdentityHashHelper(isolate, this);
Object* new_properties = properties;
Expand All @@ -6337,6 +6343,7 @@ void JSReceiver::SetProperties(HeapObject* properties) {

template <typename ProxyType>
Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
DisallowHeapAllocation no_gc;
Object* maybe_hash = proxy->hash();
if (maybe_hash->IsSmi()) return Smi::cast(maybe_hash);

Expand All @@ -6346,6 +6353,7 @@ Smi* GetOrCreateIdentityHashHelper(Isolate* isolate, ProxyType* proxy) {
}

Object* JSObject::GetIdentityHash(Isolate* isolate) {
DisallowHeapAllocation no_gc;
if (IsJSGlobalProxy()) {
return JSGlobalProxy::cast(this)->hash();
}
Expand All @@ -6359,6 +6367,7 @@ Object* JSObject::GetIdentityHash(Isolate* isolate) {
}

Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) {
DisallowHeapAllocation no_gc;
if (IsJSGlobalProxy()) {
return GetOrCreateIdentityHashHelper(isolate, JSGlobalProxy::cast(this));
}
Expand Down