Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index e5df84bb100c8ef8a2b79f184d8e761b77a97461..5382b411e6bb563a58139215f85900b7446f34f1 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -6024,17 +6024,6 @@ bool JSReceiver::OrdinaryDefineOwnProperty(Isolate* isolate, |
LookupIterator it = LookupIterator::PropertyOrElement( |
isolate, object, key, &success, LookupIterator::HIDDEN); |
DCHECK(success); // ...so creating a LookupIterator can't fail. |
- |
- // Deal with access checks first. |
- if (it.state() == LookupIterator::ACCESS_CHECK) { |
- if (!it.HasAccess()) { |
- isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>()); |
- RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, false); |
- return false; |
- } |
- it.Next(); |
- } |
- |
return OrdinaryDefineOwnProperty(&it, desc, should_throw); |
} |
@@ -6053,14 +6042,9 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, |
isolate->has_pending_exception()) { |
return false; |
} |
- // TODO(jkummerow/verwaest): It would be nice if we didn't have to reset |
- // the iterator every time. Currently, the reasons why we need it are: |
- // - handle interceptors correctly |
- // - handle accessors correctly (which might change the holder's map) |
- it->Restart(); |
// 3. Let extensible be the value of the [[Extensible]] internal slot of O. |
- Handle<JSObject> object = Handle<JSObject>::cast(it->GetReceiver()); |
- bool extensible = JSObject::IsExtensible(object); |
+ Handle<JSObject> o = Handle<JSObject>::cast(it->GetReceiver()); |
+ bool extensible = JSObject::IsExtensible(o); |
bool desc_is_data_descriptor = PropertyDescriptor::IsDataDescriptor(desc); |
bool desc_is_accessor_descriptor = |
@@ -6089,7 +6073,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, |
// [[Configurable]] attribute values are described by Desc. If the value |
// of an attribute field of Desc is absent, the attribute of the newly |
// created property is set to its default value. |
- if (!object->IsUndefined()) { |
+ if (!o->IsUndefined()) { |
if (!desc->has_writable()) desc->set_writable(false); |
if (!desc->has_enumerable()) desc->set_enumerable(false); |
if (!desc->has_configurable()) desc->set_configurable(false); |
@@ -6098,8 +6082,8 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, |
? desc->value() |
: Handle<Object>::cast(isolate->factory()->undefined_value())); |
MaybeHandle<Object> result = |
- JSObject::DefineOwnPropertyIgnoreAttributes( |
- it, value, desc->ToAttributes(), JSObject::DONT_FORCE_FIELD); |
+ JSObject::DefineOwnPropertyIgnoreAttributes(it, value, |
+ desc->ToAttributes()); |
if (result.is_null()) return false; |
} |
} else { |
@@ -6110,7 +6094,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, |
// [[Configurable]] attribute values are described by Desc. If the value |
// of an attribute field of Desc is absent, the attribute of the newly |
// created property is set to its default value. |
- if (!object->IsUndefined()) { |
+ if (!o->IsUndefined()) { |
if (!desc->has_enumerable()) desc->set_enumerable(false); |
if (!desc->has_configurable()) desc->set_configurable(false); |
Handle<Object> getter( |
@@ -6210,11 +6194,10 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, |
// [Strong mode] Disallow changing writable -> readonly for |
// non-configurable properties. |
if (current.writable() && desc->has_writable() && !desc->writable() && |
- object->map()->is_strong()) { |
+ o->map()->is_strong()) { |
if (should_throw == THROW_ON_ERROR) { |
isolate->Throw(*isolate->factory()->NewTypeError( |
- MessageTemplate::kStrongRedefineDisallowed, object, |
- it->GetName())); |
+ MessageTemplate::kStrongRedefineDisallowed, o, it->GetName())); |
} |
return false; |
} |
@@ -6269,7 +6252,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, |
} |
// 10. If O is not undefined, then: |
- if (!object->IsUndefined()) { |
+ if (!o->IsUndefined()) { |
// 10a. For each field of Desc that is present, set the corresponding |
// attribute of the property named P of object O to the value of the field. |
PropertyAttributes attrs = NONE; |
@@ -6532,7 +6515,7 @@ bool JSArray::ArraySetLength(Isolate* isolate, Handle<JSArray> a, |
if (!success && should_throw == THROW_ON_ERROR) { |
isolate->Throw(*isolate->factory()->NewTypeError( |
MessageTemplate::kStrictDeleteProperty, |
- isolate->factory()->NewNumberFromUint(actual_new_len - 1), a)); |
+ isolate->factory()->NewNumberFromUint(actual_new_len - 1))); |
} |
return success; |
} |
@@ -6581,11 +6564,7 @@ bool JSReceiver::GetOwnPropertyDescriptor(LookupIterator* it, |
it->GetAccessors()->IsAccessorPair(); |
if (!is_accessor_pair) { |
// 5a. Set D.[[Value]] to the value of X's [[Value]] attribute. |
- Handle<Object> value; |
- if (!JSObject::GetProperty(it).ToHandle(&value)) { |
- DCHECK(isolate->has_pending_exception()); |
- return false; |
- } |
+ Handle<Object> value = JSObject::GetProperty(it).ToHandleChecked(); |
desc->set_value(value); |
// 5b. Set D.[[Writable]] to the value of X's [[Writable]] attribute |
desc->set_writable((attrs & READ_ONLY) == 0); |
@@ -7805,10 +7784,7 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
DCHECK(filter == INCLUDE_SYMBOLS); |
PropertyAttributes attr_filter = |
static_cast<PropertyAttributes>(DONT_ENUM | PRIVATE_SYMBOL); |
- Handle<FixedArray> property_keys = isolate->factory()->NewFixedArray( |
- current->NumberOfOwnProperties(attr_filter)); |
- current->GetOwnPropertyNames(*property_keys, 0, attr_filter); |
- accumulator.AddKeys(property_keys); |
+ JSObject::CollectOwnElementKeys(current, &accumulator, attr_filter); |
} |
// Add the property keys from the interceptor. |