Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 934c8f39335e3dcdecfcf55ede0e0f3220ea540c..d60fb7c1aaa356611a6d8d8f4115a2cfeb16dbef 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -6260,13 +6260,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); |
@@ -6310,6 +6303,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); |
@@ -6322,14 +6317,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); |
@@ -6348,6 +6336,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 |
@@ -6356,12 +6350,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; |