Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 1e5315b978e67fb8e9314cd993a5184f60ff3269..49e8b52d944f7b65c362460db47f6cb6001864a6 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -6054,8 +6054,8 @@ |
return false; |
} |
// 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 = |
@@ -6074,12 +6074,12 @@ |
} |
return false; |
} |
- // We have to reset the LookupIterator to handle interceptors properly. |
- Map* map = Handle<HeapObject>::cast(object)->map(); |
- if ((it->IsElement() && map->has_indexed_interceptor()) || |
- (!it->IsElement() && map->has_named_interceptor())) { |
- it->Restart(); |
- } |
+ // We have to use a fresh LookupIterator to handle interceptors properly. |
+ LookupIterator lookup_for_store = |
+ it->IsElement() ? LookupIterator(isolate, it->GetReceiver(), |
+ it->index(), LookupIterator::HIDDEN) |
+ : LookupIterator(it->GetReceiver(), it->name(), |
+ LookupIterator::HIDDEN); |
// 2c. If IsGenericDescriptor(Desc) or IsDataDescriptor(Desc) is true, then: |
// (This is equivalent to !IsAccessorDescriptor(desc).) |
@@ -6091,7 +6091,7 @@ |
// [[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); |
@@ -6101,7 +6101,8 @@ |
: Handle<Object>::cast(isolate->factory()->undefined_value())); |
MaybeHandle<Object> result = |
JSObject::DefineOwnPropertyIgnoreAttributes( |
- it, value, desc->ToAttributes(), JSObject::DONT_FORCE_FIELD); |
+ &lookup_for_store, value, desc->ToAttributes(), |
+ JSObject::DONT_FORCE_FIELD); |
if (result.is_null()) return false; |
} |
} else { |
@@ -6112,7 +6113,7 @@ |
// [[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( |
@@ -6123,8 +6124,8 @@ |
desc->has_set() |
? desc->set() |
: Handle<Object>::cast(isolate->factory()->undefined_value())); |
- MaybeHandle<Object> result = |
- JSObject::DefineAccessor(it, getter, setter, desc->ToAttributes()); |
+ MaybeHandle<Object> result = JSObject::DefineAccessor( |
+ &lookup_for_store, getter, setter, desc->ToAttributes()); |
if (result.is_null()) return false; |
} |
} |
@@ -6212,11 +6213,10 @@ |
// [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; |
} |
@@ -6271,7 +6271,7 @@ |
} |
// 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; |