Reviewers: Igor Sheludko,
Message:
ptal
Description:
Restore ExecutableAccessorInfoHandling for now
BUG=v8:4137
LOG=n
Please review this at https://codereview.chromium.org/1173283004/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+24, -13 lines):
M src/objects.h
M src/objects.cc
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
86f0900728b6ef90365183b9f1b5dfc6f875599b..99eb0cd776861ae05eb1213c0ae395836233da76
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3168,8 +3168,9 @@ MaybeHandle<Object>
Object::SetSuperProperty(LookupIterator* it,
case LookupIterator::DATA: {
PropertyDetails details = own_lookup.property_details();
if (details.IsConfigurable() || !details.IsReadOnly()) {
- return JSObject::ReconfigureAsDataProperty(&own_lookup, value,
- details.attributes());
+ return JSObject::ReconfigureAsDataProperty(
+ &own_lookup, value, details.attributes(),
+ JSObject::DONT_FORCE_FIELD);
}
return WriteToReadOnlyProperty(&own_lookup, value, language_mode);
}
@@ -3177,8 +3178,9 @@ MaybeHandle<Object>
Object::SetSuperProperty(LookupIterator* it,
case LookupIterator::ACCESSOR: {
PropertyDetails details = own_lookup.property_details();
if (details.IsConfigurable()) {
- return JSObject::ReconfigureAsDataProperty(&own_lookup, value,
- details.attributes());
+ return JSObject::ReconfigureAsDataProperty(
+ &own_lookup, value, details.attributes(),
+ JSObject::DONT_FORCE_FIELD);
}
return RedefineNonconfigurableProperty(it->isolate(),
it->GetName(),
@@ -4133,7 +4135,8 @@ void
ExecutableAccessorInfo::ClearSetter(Handle<ExecutableAccessorInfo> info) {
MaybeHandle<Object> JSObject::ReconfigureAsDataProperty(
- LookupIterator* it, Handle<Object> value, PropertyAttributes
attributes) {
+ LookupIterator* it, Handle<Object> value, PropertyAttributes
attributes,
+ ExecutableAccessorInfoHandling handling) {
Handle<JSObject> object = Handle<JSObject>::cast(it->GetReceiver());
bool is_observed = object->map()->is_observed() &&
(it->IsElement() ||
@@ -4159,7 +4162,8 @@ MaybeHandle<Object>
JSObject::ReconfigureAsDataProperty(
// Special handling for ExecutableAccessorInfo, which behaves like a
// data property.
- if (accessors->IsExecutableAccessorInfo()) {
+ if (accessors->IsExecutableAccessorInfo() &&
+ handling == DONT_FORCE_FIELD) {
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
it->isolate(), result,
@@ -4252,7 +4256,7 @@ MaybeHandle<Object>
JSObject::ReconfigureAsDataProperty(
// reconfigurable.
MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
- PropertyAttributes attributes) {
+ PropertyAttributes attributes, ExecutableAccessorInfoHandling
handling) {
DCHECK(!value->IsTheHole());
LookupIterator it(object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
if (it.state() == LookupIterator::ACCESS_CHECK) {
@@ -4263,7 +4267,7 @@ MaybeHandle<Object>
JSObject::SetOwnPropertyIgnoreAttributes(
}
if (it.IsFound()) {
- return ReconfigureAsDataProperty(&it, value, attributes);
+ return ReconfigureAsDataProperty(&it, value, attributes, handling);
}
return AddDataProperty(&it, value, attributes, STRICT,
@@ -4273,7 +4277,7 @@ MaybeHandle<Object>
JSObject::SetOwnPropertyIgnoreAttributes(
MaybeHandle<Object> JSObject::SetOwnElementIgnoreAttributes(
Handle<JSObject> object, uint32_t index, Handle<Object> value,
- PropertyAttributes attributes) {
+ PropertyAttributes attributes, ExecutableAccessorInfoHandling
handling) {
DCHECK(!object->HasExternalArrayElements());
Isolate* isolate = object->GetIsolate();
LookupIterator it(isolate, object, index,
@@ -4286,7 +4290,7 @@ MaybeHandle<Object>
JSObject::SetOwnElementIgnoreAttributes(
}
if (it.IsFound()) {
- return ReconfigureAsDataProperty(&it, value, attributes);
+ return ReconfigureAsDataProperty(&it, value, attributes, handling);
}
return AddDataProperty(&it, value, attributes, STRICT,
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
bd9e4abe71354c1936cb5bac273dfa645fc2a0cb..dc5b56e8c0af18e0b246bfc6acec5aaf26648b4d
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1841,16 +1841,23 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor(
LookupIterator* it, Handle<Object> value);
+ // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We
need to
+ // grant an exemption to ExecutableAccessor callbacks in some cases.
+ enum ExecutableAccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD
};
+
MUST_USE_RESULT static MaybeHandle<Object>
SetOwnPropertyIgnoreAttributes(
Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
- PropertyAttributes attributes);
+ PropertyAttributes attributes,
+ ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes(
Handle<JSObject> object, uint32_t index, Handle<Object> value,
- PropertyAttributes attributes);
+ PropertyAttributes attributes,
+ ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
MUST_USE_RESULT static MaybeHandle<Object> ReconfigureAsDataProperty(
- LookupIterator* it, Handle<Object> value, PropertyAttributes
attributes);
+ LookupIterator* it, Handle<Object> value, PropertyAttributes
attributes,
+ ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
static void AddProperty(Handle<JSObject> object, Handle<Name> name,
Handle<Object> value, PropertyAttributes
attributes);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.