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

Unified Diff: src/lookup.cc

Issue 1228803005: Replace Set*Callback with TransitionToAccessorPair (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 | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index e794ad5a1242850f4739b944035bb1a6a965d3a9..7bc3aebe84cec4a11bd2bdd69dd1beeb235ad1ae 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -277,9 +277,9 @@ void LookupIterator::TransitionToAccessorProperty(
// handled via a trap. Adding properties to primitive values is not
// observable.
Handle<JSObject> receiver = GetStoreTarget();
- holder_ = receiver;
if (!IsElement() && !receiver->map()->is_dictionary_map()) {
+ holder_ = receiver;
holder_map_ = Map::TransitionToAccessorProperty(
handle(receiver->map(), isolate_), name_, component, accessor,
attributes);
@@ -290,8 +290,6 @@ void LookupIterator::TransitionToAccessorProperty(
if (!holder_map_->is_dictionary_map()) return;
}
- PropertyDetails details(attributes, ACCESSOR_CONSTANT, 0,
- PropertyCellType::kMutable);
Handle<AccessorPair> pair;
if (state() == ACCESSOR && GetAccessors()->IsAccessorPair()) {
pair = Handle<AccessorPair>::cast(GetAccessors());
@@ -307,6 +305,18 @@ void LookupIterator::TransitionToAccessorProperty(
pair->set(component, *accessor);
}
+ TransitionToAccessorPair(pair, attributes);
+}
+
+
+void LookupIterator::TransitionToAccessorPair(Handle<Object> pair,
+ PropertyAttributes attributes) {
+ Handle<JSObject> receiver = GetStoreTarget();
+ holder_ = receiver;
+
+ PropertyDetails details(attributes, ACCESSOR_CONSTANT, 0,
+ PropertyCellType::kMutable);
+
if (IsElement()) {
// TODO(verwaest): Remove this hack once we have a quick way to check the
// prototype chain in element setters.
@@ -331,6 +341,13 @@ void LookupIterator::TransitionToAccessorProperty(
if (!was_dictionary) heap()->ClearAllICsByKind(Code::KEYED_STORE_IC);
}
} else {
+ PropertyNormalizationMode mode = receiver->map()->is_prototype_map()
+ ? KEEP_INOBJECT_PROPERTIES
+ : CLEAR_INOBJECT_PROPERTIES;
+ // Normalize object to make this operation simple.
+ JSObject::NormalizeProperties(receiver, mode, 0,
+ "TransitionToAccessorPair");
+
JSObject::SetNormalizedProperty(receiver, name_, pair, details);
JSObject::ReoptimizeIfPrototype(receiver);
}
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698