Commit 6fecd179 authored by verwaest's avatar verwaest Committed by Commit bot

[LookupIterator] Avoid additional descriptor lookup in TransitionToAccessorProperty

BUG=588893, 325923
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#34493}
parent 683223b4
...@@ -381,10 +381,19 @@ void LookupIterator::TransitionToAccessorProperty( ...@@ -381,10 +381,19 @@ void LookupIterator::TransitionToAccessorProperty(
Handle<JSObject> receiver = GetStoreTarget(); Handle<JSObject> receiver = GetStoreTarget();
if (!IsElement() && !receiver->map()->is_dictionary_map()) { if (!IsElement() && !receiver->map()->is_dictionary_map()) {
holder_ = receiver;
Handle<Map> old_map(receiver->map(), isolate_); Handle<Map> old_map(receiver->map(), isolate_);
if (!holder_.is_identical_to(receiver)) {
holder_ = receiver;
state_ = NOT_FOUND;
} else if (state_ == INTERCEPTOR) {
LookupInRegularHolder<false>(*old_map, *holder_);
}
int descriptor =
IsFound() ? static_cast<int>(number_) : DescriptorArray::kNotFound;
Handle<Map> new_map = Map::TransitionToAccessorProperty( Handle<Map> new_map = Map::TransitionToAccessorProperty(
old_map, name_, component, accessor, attributes); old_map, name_, descriptor, component, accessor, attributes);
bool simple_transition = new_map->GetBackPointer() == receiver->map(); bool simple_transition = new_map->GetBackPointer() == receiver->map();
JSObject::MigrateToMap(receiver, new_map); JSObject::MigrateToMap(receiver, new_map);
......
...@@ -9816,9 +9816,8 @@ Handle<Map> Map::ReconfigureExistingProperty(Handle<Map> map, int descriptor, ...@@ -9816,9 +9816,8 @@ Handle<Map> Map::ReconfigureExistingProperty(Handle<Map> map, int descriptor,
return new_map; return new_map;
} }
Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map, Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
Handle<Name> name, Handle<Name> name, int descriptor,
AccessorComponent component, AccessorComponent component,
Handle<Object> accessor, Handle<Object> accessor,
PropertyAttributes attributes) { PropertyAttributes attributes) {
...@@ -9861,7 +9860,6 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map, ...@@ -9861,7 +9860,6 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
Handle<AccessorPair> pair; Handle<AccessorPair> pair;
DescriptorArray* old_descriptors = map->instance_descriptors(); DescriptorArray* old_descriptors = map->instance_descriptors();
int descriptor = old_descriptors->SearchWithCache(isolate, *name, *map);
if (descriptor != DescriptorArray::kNotFound) { if (descriptor != DescriptorArray::kNotFound) {
if (descriptor != map->LastAdded()) { if (descriptor != map->LastAdded()) {
return Map::Normalize(map, mode, "AccessorsOverwritingNonLast"); return Map::Normalize(map, mode, "AccessorsOverwritingNonLast");
......
...@@ -5988,8 +5988,9 @@ class Map: public HeapObject { ...@@ -5988,8 +5988,9 @@ class Map: public HeapObject {
PropertyAttributes attributes, PropertyAttributes attributes,
StoreFromKeyed store_mode); StoreFromKeyed store_mode);
static Handle<Map> TransitionToAccessorProperty( static Handle<Map> TransitionToAccessorProperty(
Handle<Map> map, Handle<Name> name, AccessorComponent component, Handle<Map> map, Handle<Name> name, int descriptor,
Handle<Object> accessor, PropertyAttributes attributes); AccessorComponent component, Handle<Object> accessor,
PropertyAttributes attributes);
static Handle<Map> ReconfigureExistingProperty(Handle<Map> map, static Handle<Map> ReconfigureExistingProperty(Handle<Map> map,
int descriptor, int descriptor,
PropertyKind kind, PropertyKind kind,
......
...@@ -399,13 +399,17 @@ class Expectations { ...@@ -399,13 +399,17 @@ class Expectations {
Handle<Object> getter(pair->getter(), isolate); Handle<Object> getter(pair->getter(), isolate);
Handle<Object> setter(pair->setter(), isolate); Handle<Object> setter(pair->setter(), isolate);
map = Map::TransitionToAccessorProperty(map, name, ACCESSOR_GETTER, getter, int descriptor =
attributes); map->instance_descriptors()->SearchWithCache(isolate, *name, *map);
map = Map::TransitionToAccessorProperty(
map, name, descriptor, ACCESSOR_GETTER, getter, attributes);
CHECK(!map->is_deprecated()); CHECK(!map->is_deprecated());
CHECK(!map->is_dictionary_map()); CHECK(!map->is_dictionary_map());
map = Map::TransitionToAccessorProperty(map, name, ACCESSOR_SETTER, setter, descriptor =
attributes); map->instance_descriptors()->SearchWithCache(isolate, *name, *map);
map = Map::TransitionToAccessorProperty(
map, name, descriptor, ACCESSOR_SETTER, setter, attributes);
CHECK(!map->is_deprecated()); CHECK(!map->is_deprecated());
CHECK(!map->is_dictionary_map()); CHECK(!map->is_dictionary_map());
return map; return map;
......
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