Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 1f4881037bdd80375a9a503981714dedc880a72a..a7b89cfcda4e78d0a4ef994968459221dcd8c716 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -3143,12 +3143,39 @@ MaybeHandle<Object> Object::SetProperty(LookupIterator* it, |
| Object); |
| } |
| + // super.property = value |
| + // No property was found starting from the prototype of [[HomeObject]]. |
| if (data_store_mode == SUPER_PROPERTY) { |
|
arv (Not doing code reviews)
2015/02/17 20:41:22
To me it looks like this if can be skipped since t
|
| LookupIterator own_lookup(it->GetReceiver(), it->name(), |
| LookupIterator::OWN); |
| + if (!own_lookup.IsFound()) { |
|
arv (Not doing code reviews)
2015/02/17 20:41:22
Is there an existing function that can be used her
|
| + return AddDataProperty(&own_lookup, value, NONE, language_mode, |
| + store_mode); |
| + } |
| + |
| + PropertyDetails details = own_lookup.property_details(); |
| + |
| + // Otherwise reconfigure property with descriptor {value: value}. |
| + if (details.IsConfigurable()) { |
| + return JSObject::SetOwnPropertyIgnoreAttributes( |
| + Handle<JSObject>::cast(it->GetReceiver()), it->name(), value, |
| + details.attributes()); |
| + } |
| + |
| + if (details.IsReadOnly()) { |
| + return WriteToReadOnlyProperty(&own_lookup, value, language_mode); |
| + } |
| - return JSObject::SetProperty(&own_lookup, value, language_mode, store_mode, |
| - NORMAL_PROPERTY); |
| + // Not configurable but writable. |
| + if (details.kind() == kData) { |
| + return SetDataProperty(&own_lookup, value); |
| + } |
| + |
| + Handle<Object> args[] = {it->name()}; |
| + THROW_NEW_ERROR(it->isolate(), |
| + NewTypeError("redefine_disallowed", |
| + HandleVector(args, arraysize(args))), |
| + Object); |
| } |
| return AddDataProperty(it, value, NONE, language_mode, store_mode); |