[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}
This commit is contained in:
parent
683223b4ba
commit
6fecd1795d
@ -381,10 +381,19 @@ void LookupIterator::TransitionToAccessorProperty(
|
||||
Handle<JSObject> receiver = GetStoreTarget();
|
||||
|
||||
if (!IsElement() && !receiver->map()->is_dictionary_map()) {
|
||||
holder_ = receiver;
|
||||
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(
|
||||
old_map, name_, component, accessor, attributes);
|
||||
old_map, name_, descriptor, component, accessor, attributes);
|
||||
bool simple_transition = new_map->GetBackPointer() == receiver->map();
|
||||
JSObject::MigrateToMap(receiver, new_map);
|
||||
|
||||
|
@ -9816,9 +9816,8 @@ Handle<Map> Map::ReconfigureExistingProperty(Handle<Map> map, int descriptor,
|
||||
return new_map;
|
||||
}
|
||||
|
||||
|
||||
Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
|
||||
Handle<Name> name,
|
||||
Handle<Name> name, int descriptor,
|
||||
AccessorComponent component,
|
||||
Handle<Object> accessor,
|
||||
PropertyAttributes attributes) {
|
||||
@ -9861,7 +9860,6 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
|
||||
|
||||
Handle<AccessorPair> pair;
|
||||
DescriptorArray* old_descriptors = map->instance_descriptors();
|
||||
int descriptor = old_descriptors->SearchWithCache(isolate, *name, *map);
|
||||
if (descriptor != DescriptorArray::kNotFound) {
|
||||
if (descriptor != map->LastAdded()) {
|
||||
return Map::Normalize(map, mode, "AccessorsOverwritingNonLast");
|
||||
|
@ -5988,8 +5988,9 @@ class Map: public HeapObject {
|
||||
PropertyAttributes attributes,
|
||||
StoreFromKeyed store_mode);
|
||||
static Handle<Map> TransitionToAccessorProperty(
|
||||
Handle<Map> map, Handle<Name> name, AccessorComponent component,
|
||||
Handle<Object> accessor, PropertyAttributes attributes);
|
||||
Handle<Map> map, Handle<Name> name, int descriptor,
|
||||
AccessorComponent component, Handle<Object> accessor,
|
||||
PropertyAttributes attributes);
|
||||
static Handle<Map> ReconfigureExistingProperty(Handle<Map> map,
|
||||
int descriptor,
|
||||
PropertyKind kind,
|
||||
|
@ -399,13 +399,17 @@ class Expectations {
|
||||
Handle<Object> getter(pair->getter(), isolate);
|
||||
Handle<Object> setter(pair->setter(), isolate);
|
||||
|
||||
map = Map::TransitionToAccessorProperty(map, name, ACCESSOR_GETTER, getter,
|
||||
attributes);
|
||||
int descriptor =
|
||||
map->instance_descriptors()->SearchWithCache(isolate, *name, *map);
|
||||
map = Map::TransitionToAccessorProperty(
|
||||
map, name, descriptor, ACCESSOR_GETTER, getter, attributes);
|
||||
CHECK(!map->is_deprecated());
|
||||
CHECK(!map->is_dictionary_map());
|
||||
|
||||
map = Map::TransitionToAccessorProperty(map, name, ACCESSOR_SETTER, setter,
|
||||
attributes);
|
||||
descriptor =
|
||||
map->instance_descriptors()->SearchWithCache(isolate, *name, *map);
|
||||
map = Map::TransitionToAccessorProperty(
|
||||
map, name, descriptor, ACCESSOR_SETTER, setter, attributes);
|
||||
CHECK(!map->is_deprecated());
|
||||
CHECK(!map->is_dictionary_map());
|
||||
return map;
|
||||
|
Loading…
Reference in New Issue
Block a user