| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 98b3056eedf7e528247cf4624c63925aff438566..e6ddc0cdfa04d92b4e7d7a4a630d2eaa05cbc992 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -5824,162 +5824,6 @@ Handle<Smi> JSProxy::GetOrCreateIdentityHash(Handle<JSProxy> proxy) {
|
| }
|
|
|
|
|
| -Object* JSObject::GetHiddenProperty(Handle<Name> key) {
|
| - DisallowHeapAllocation no_gc;
|
| - DCHECK(key->IsUniqueName());
|
| - if (IsJSGlobalProxy()) {
|
| - // For a proxy, use the prototype as target object.
|
| - PrototypeIterator iter(GetIsolate(), this);
|
| - // If the proxy is detached, return undefined.
|
| - if (iter.IsAtEnd()) return GetHeap()->the_hole_value();
|
| - DCHECK(iter.GetCurrent()->IsJSGlobalObject());
|
| - return iter.GetCurrent<JSObject>()->GetHiddenProperty(key);
|
| - }
|
| - DCHECK(!IsJSGlobalProxy());
|
| - Object* inline_value = GetHiddenPropertiesHashTable();
|
| -
|
| - if (inline_value->IsUndefined()) return GetHeap()->the_hole_value();
|
| -
|
| - ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value);
|
| - Object* entry = hashtable->Lookup(key);
|
| - return entry;
|
| -}
|
| -
|
| -
|
| -Handle<Object> JSObject::SetHiddenProperty(Handle<JSObject> object,
|
| - Handle<Name> key,
|
| - Handle<Object> value) {
|
| - Isolate* isolate = object->GetIsolate();
|
| -
|
| - DCHECK(key->IsUniqueName());
|
| - if (object->IsJSGlobalProxy()) {
|
| - // For a proxy, use the prototype as target object.
|
| - PrototypeIterator iter(isolate, object);
|
| - // If the proxy is detached, return undefined.
|
| - if (iter.IsAtEnd()) return isolate->factory()->undefined_value();
|
| - DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
|
| - return SetHiddenProperty(PrototypeIterator::GetCurrent<JSObject>(iter), key,
|
| - value);
|
| - }
|
| - DCHECK(!object->IsJSGlobalProxy());
|
| -
|
| - Handle<Object> inline_value(object->GetHiddenPropertiesHashTable(), isolate);
|
| -
|
| - Handle<ObjectHashTable> hashtable =
|
| - GetOrCreateHiddenPropertiesHashtable(object);
|
| -
|
| - // If it was found, check if the key is already in the dictionary.
|
| - Handle<ObjectHashTable> new_table = ObjectHashTable::Put(hashtable, key,
|
| - value);
|
| - if (*new_table != *hashtable) {
|
| - // If adding the key expanded the dictionary (i.e., Add returned a new
|
| - // dictionary), store it back to the object.
|
| - SetHiddenPropertiesHashTable(object, new_table);
|
| - }
|
| -
|
| - // Return this to mark success.
|
| - return object;
|
| -}
|
| -
|
| -
|
| -void JSObject::DeleteHiddenProperty(Handle<JSObject> object, Handle<Name> key) {
|
| - Isolate* isolate = object->GetIsolate();
|
| - DCHECK(key->IsUniqueName());
|
| -
|
| - if (object->IsJSGlobalProxy()) {
|
| - PrototypeIterator iter(isolate, object);
|
| - if (iter.IsAtEnd()) return;
|
| - DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
|
| - return DeleteHiddenProperty(PrototypeIterator::GetCurrent<JSObject>(iter),
|
| - key);
|
| - }
|
| -
|
| - Object* inline_value = object->GetHiddenPropertiesHashTable();
|
| -
|
| - if (inline_value->IsUndefined()) return;
|
| -
|
| - Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value));
|
| - bool was_present = false;
|
| - ObjectHashTable::Remove(hashtable, key, &was_present);
|
| -}
|
| -
|
| -
|
| -bool JSObject::HasHiddenProperties(Handle<JSObject> object) {
|
| - Isolate* isolate = object->GetIsolate();
|
| - Handle<Symbol> hidden = isolate->factory()->hidden_properties_symbol();
|
| - LookupIterator it(object, hidden, object);
|
| - Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it);
|
| - // Cannot get an exception since the hidden_properties_symbol isn't exposed to
|
| - // JS.
|
| - DCHECK(maybe.IsJust());
|
| - return maybe.FromJust() != ABSENT;
|
| -}
|
| -
|
| -
|
| -Object* JSObject::GetHiddenPropertiesHashTable() {
|
| - DCHECK(!IsJSGlobalProxy());
|
| - if (HasFastProperties()) {
|
| - // If the object has fast properties, check whether the first slot
|
| - // in the descriptor array matches the hidden string. Since the
|
| - // hidden strings hash code is zero (and no other name has hash
|
| - // code zero) it will always occupy the first entry if present.
|
| - DescriptorArray* descriptors = this->map()->instance_descriptors();
|
| - if (descriptors->number_of_descriptors() > 0) {
|
| - int sorted_index = descriptors->GetSortedKeyIndex(0);
|
| - if (descriptors->GetKey(sorted_index) ==
|
| - GetHeap()->hidden_properties_symbol() &&
|
| - sorted_index < map()->NumberOfOwnDescriptors()) {
|
| - DCHECK(descriptors->GetType(sorted_index) == DATA);
|
| - DCHECK(descriptors->GetDetails(sorted_index).representation().
|
| - IsCompatibleForLoad(Representation::Tagged()));
|
| - FieldIndex index = FieldIndex::ForDescriptor(this->map(),
|
| - sorted_index);
|
| - return this->RawFastPropertyAt(index);
|
| - } else {
|
| - return GetHeap()->undefined_value();
|
| - }
|
| - } else {
|
| - return GetHeap()->undefined_value();
|
| - }
|
| - } else {
|
| - Isolate* isolate = GetIsolate();
|
| - Handle<Symbol> hidden = isolate->factory()->hidden_properties_symbol();
|
| - Handle<JSObject> receiver(this, isolate);
|
| - LookupIterator it(receiver, hidden, receiver);
|
| - // Access check is always skipped for the hidden string anyways.
|
| - return *GetDataProperty(&it);
|
| - }
|
| -}
|
| -
|
| -Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable(
|
| - Handle<JSObject> object) {
|
| - Isolate* isolate = object->GetIsolate();
|
| -
|
| - static const int kInitialCapacity = 4;
|
| - Handle<Object> inline_value(object->GetHiddenPropertiesHashTable(), isolate);
|
| - if (inline_value->IsHashTable()) {
|
| - return Handle<ObjectHashTable>::cast(inline_value);
|
| - }
|
| -
|
| - Handle<ObjectHashTable> hashtable = ObjectHashTable::New(
|
| - isolate, kInitialCapacity, USE_CUSTOM_MINIMUM_CAPACITY);
|
| -
|
| - DCHECK(inline_value->IsUndefined());
|
| - SetHiddenPropertiesHashTable(object, hashtable);
|
| - return hashtable;
|
| -}
|
| -
|
| -
|
| -Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject> object,
|
| - Handle<Object> value) {
|
| - DCHECK(!object->IsJSGlobalProxy());
|
| - Isolate* isolate = object->GetIsolate();
|
| - Handle<Symbol> name = isolate->factory()->hidden_properties_symbol();
|
| - SetOwnPropertyIgnoreAttributes(object, name, value, DONT_ENUM).Assert();
|
| - return object;
|
| -}
|
| -
|
| -
|
| Maybe<bool> JSObject::DeletePropertyWithInterceptor(LookupIterator* it,
|
| ShouldThrow should_throw) {
|
| Isolate* isolate = it->isolate();
|
|
|