| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index b82d377f71fda4040cdcb5784c0f14744a64f42b..e7d23f13457d499a3e885acb48740f28b002803e 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -5239,29 +5239,6 @@ RUNTIME_FUNCTION(Runtime_DefineOrRedefineDataProperty) {
|
| LookupResult lookup(isolate);
|
| js_object->LocalLookupRealNamedProperty(name, &lookup);
|
|
|
| - // Special case for callback properties.
|
| - if (lookup.IsPropertyCallbacks()) {
|
| - Handle<Object> callback(lookup.GetCallbackObject(), isolate);
|
| - // Avoid redefining callback as data property, just use the stored
|
| - // setter to update the value instead.
|
| - // TODO(mstarzinger): So far this only works if property attributes don't
|
| - // change, this should be fixed once we cleanup the underlying code.
|
| - ASSERT(!callback->IsForeign());
|
| - if (callback->IsAccessorInfo() &&
|
| - lookup.GetAttributes() == attr) {
|
| - Handle<Object> result_object;
|
| - ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
| - isolate, result_object,
|
| - JSObject::SetPropertyWithCallback(js_object,
|
| - callback,
|
| - name,
|
| - obj_value,
|
| - handle(lookup.holder()),
|
| - STRICT));
|
| - return *result_object;
|
| - }
|
| - }
|
| -
|
| // Take special care when attributes are different and there is already
|
| // a property. For simplicity we normalize the property which enables us
|
| // to not worry about changing the instance_descriptor and creating a new
|
| @@ -5276,14 +5253,25 @@ RUNTIME_FUNCTION(Runtime_DefineOrRedefineDataProperty) {
|
| // we don't have to check for null.
|
| js_object = Handle<JSObject>(JSObject::cast(js_object->GetPrototype()));
|
| }
|
| - JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
|
| +
|
| + if (attr != lookup.GetAttributes() ||
|
| + (lookup.IsPropertyCallbacks() &&
|
| + !lookup.GetCallbackObject()->IsAccessorInfo())) {
|
| + JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
|
| + }
|
| +
|
| // Use IgnoreAttributes version since a readonly property may be
|
| // overridden and SetProperty does not allow this.
|
| Handle<Object> result;
|
| ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
| isolate, result,
|
| JSObject::SetLocalPropertyIgnoreAttributes(
|
| - js_object, name, obj_value, attr));
|
| + js_object, name, obj_value, attr,
|
| + Object::OPTIMAL_REPRESENTATION,
|
| + ALLOW_AS_CONSTANT,
|
| + JSReceiver::PERFORM_EXTENSIBILITY_CHECK,
|
| + JSReceiver::MAY_BE_STORE_FROM_KEYED,
|
| + JSObject::DONT_FORCE_FIELD));
|
| return *result;
|
| }
|
|
|
|
|