Commit 90952d76 authored by verwaest's avatar verwaest Committed by Commit bot

[runtime] Stop cloning AccessorInfo, just rely on PropertyAttributes for readonly.

The old mechanism was a left-over from a previous time where the runtime
would rely on the presence or absence of the setter to figure out
whether or not the property is mutable. This is unnecessary by now.

Review URL: https://codereview.chromium.org/1600923002

Cr-Commit-Position: refs/heads/master@{#33377}
parent c7c60935
......@@ -41,20 +41,6 @@ Handle<AccessorInfo> Accessors::MakeAccessor(
}
Handle<AccessorInfo> Accessors::CloneAccessor(Isolate* isolate,
Handle<AccessorInfo> accessor) {
Factory* factory = isolate->factory();
Handle<AccessorInfo> info = factory->NewAccessorInfo();
info->set_name(accessor->name());
info->set_flag(accessor->flag());
info->set_expected_receiver_type(accessor->expected_receiver_type());
info->set_getter(accessor->getter());
info->set_setter(accessor->setter());
info->set_data(accessor->data());
return info;
}
static V8_INLINE bool CheckForName(Handle<Name> name,
Handle<String> property_name,
int offset,
......
......@@ -100,9 +100,6 @@ class Accessors : public AllStatic {
AccessorNameGetterCallback getter,
AccessorNameSetterCallback setter,
PropertyAttributes attributes);
static Handle<AccessorInfo> CloneAccessor(Isolate* isolate,
Handle<AccessorInfo> accessor);
};
} // namespace internal
......
......@@ -5204,13 +5204,6 @@ void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name,
}
// static
void AccessorInfo::ClearSetter(Handle<AccessorInfo> info) {
Handle<Object> object = v8::FromCData(info->GetIsolate(), nullptr);
info->set_setter(*object);
}
// Reconfigures a property to a data property with attributes, even if it is not
// reconfigurable.
// Requires a LookupIterator that does not look at the prototype chain beyond
......@@ -5279,15 +5272,7 @@ Maybe<bool> JSObject::DefineOwnPropertyIgnoreAttributes(
if (details.attributes() == attributes) return Just(true);
// Reconfigure the accessor if attributes mismatch.
Handle<AccessorInfo> new_data = Accessors::CloneAccessor(
it->isolate(), Handle<AccessorInfo>::cast(accessors));
new_data->set_property_attributes(attributes);
// By clearing the setter we don't have to introduce a lookup to
// the setter, simply make it unavailable to reflect the
// attributes.
if (attributes & READ_ONLY) AccessorInfo::ClearSetter(new_data);
it->TransitionToAccessorPair(new_data, attributes);
it->TransitionToAccessorPair(accessors, attributes);
} else {
it->ReconfigureDataProperty(value, attributes);
}
......
......@@ -10205,8 +10205,6 @@ class AccessorInfo: public Struct {
// Dispatched behavior.
DECLARE_PRINTER(AccessorInfo)
static void ClearSetter(Handle<AccessorInfo> info);
inline bool all_can_read();
inline void set_all_can_read(bool value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment