Commit 5a52b9fe authored by verwaest's avatar verwaest Committed by Commit bot

Remove duplicate flattening. Defining accessors doesn't call out, so don't...

Remove duplicate flattening. Defining accessors doesn't call out, so don't assert that the context doesn't change.

BUG=v8:4137
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29650}
parent 103675d6
......@@ -6252,13 +6252,6 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object,
PropertyAttributes attributes) {
Isolate* isolate = object->GetIsolate();
// Make sure that the top context does not change when doing callbacks or
// interceptor calls.
AssertNoContextChange ncc(isolate);
// Try to flatten before operating on the string.
if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
LookupIterator it = LookupIterator::PropertyOrElement(
isolate, object, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
......@@ -6302,6 +6295,8 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object,
}
if (is_observed) {
// Make sure the top context isn't changed.
AssertNoContextChange ncc(isolate);
const char* type = preexists ? "reconfigure" : "add";
RETURN_ON_EXCEPTION(
isolate, EnqueueChangeRecord(object, type, name, old_value), Object);
......@@ -6314,14 +6309,7 @@ MaybeHandle<Object> JSObject::DefineAccessor(Handle<JSObject> object,
MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object,
Handle<AccessorInfo> info) {
Isolate* isolate = object->GetIsolate();
// Make sure that the top context does not change when doing callbacks or
// interceptor calls.
AssertNoContextChange ncc(isolate);
// Try to flatten before operating on the string.
Handle<Name> name(Name::cast(info->name()));
if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
Handle<Name> name(Name::cast(info->name()), isolate);
LookupIterator it = LookupIterator::PropertyOrElement(
isolate, object, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
......@@ -6340,6 +6328,12 @@ MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object,
it.Next();
}
// Ignore accessors on typed arrays.
if (it.IsElement() && (object->HasFixedTypedArrayElements() ||
object->HasExternalArrayElements())) {
return it.factory()->undefined_value();
}
CHECK(GetPropertyAttributes(&it).IsJust());
// ES5 forbids turning a property into an accessor if it's not
......@@ -6348,12 +6342,6 @@ MaybeHandle<Object> JSObject::SetAccessor(Handle<JSObject> object,
return it.factory()->undefined_value();
}
// Ignore accessors on typed arrays.
if (it.IsElement() && (object->HasFixedTypedArrayElements() ||
object->HasExternalArrayElements())) {
return it.factory()->undefined_value();
}
it.TransitionToAccessorPair(info, info->property_attributes());
return object;
......
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