Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(857)

Unified Diff: src/objects.cc

Issue 934463003: super.property store (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/super.js » ('j') | test/mjsunit/harmony/super.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | test/mjsunit/harmony/super.js » ('j') | test/mjsunit/harmony/super.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698