Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Unified Diff: src/objects.cc

Issue 1233073003: Remove duplicate flattening. Defining accessors doesn't call out, so don't assert that the context … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698