Commit 27b41ea0 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Restore the descriptor lookup cache outside of Turbofan.

This partially reverts commit bffe040e,
which bypassed the cache globally. Now we bypass it only in Turbofan.

R=jarin@chromium.org

Bug: v8:7790, chromium:854976
Change-Id: I62a9904c06915f6f6e4a6b628dc3dcba5151bb87
Reviewed-on: https://chromium-review.googlesource.com/1109969Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53955}
parent 85ed06e9
......@@ -349,7 +349,7 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
do {
// Lookup the named property on the {map}.
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate());
int const number = descriptors->SearchWithCache(isolate(), *name, *map);
int const number = descriptors->Search(*name, *map);
if (number != DescriptorArray::kNotFound) {
PropertyDetails const details = descriptors->GetDetails(number);
if (access_mode == AccessMode::kStore ||
......
......@@ -4235,8 +4235,7 @@ bool IsReadOnlyLengthDescriptor(Isolate* isolate, Handle<Map> jsarray_map) {
DCHECK(!jsarray_map->is_dictionary_map());
Handle<Name> length_string = isolate->factory()->length_string();
DescriptorArray* descriptors = jsarray_map->instance_descriptors();
int number =
descriptors->SearchWithCache(isolate, *length_string, *jsarray_map);
int number = descriptors->Search(*length_string, *jsarray_map);
DCHECK_NE(DescriptorArray::kNotFound, number);
return descriptors->GetDetails(number).IsReadOnly();
}
......
......@@ -1994,13 +1994,27 @@ int DescriptorArray::Search(Name* name, int valid_descriptors) {
valid_descriptors, nullptr);
}
int DescriptorArray::Search(Name* name, Map* map) {
DCHECK(name->IsUniqueName());
int number_of_own_descriptors = map->NumberOfOwnDescriptors();
if (number_of_own_descriptors == 0) return kNotFound;
return Search(name, number_of_own_descriptors);
}
int DescriptorArray::SearchWithCache(Isolate* isolate, Name* name, Map* map) {
DCHECK(name->IsUniqueName());
int number_of_own_descriptors = map->NumberOfOwnDescriptors();
if (number_of_own_descriptors == 0) return kNotFound;
// TODO(neis): As an experiment, don't actually use the cache.
return Search(name, number_of_own_descriptors);
DescriptorLookupCache* cache = isolate->descriptor_lookup_cache();
int number = cache->Lookup(map, name);
if (number == DescriptorLookupCache::kAbsent) {
number = Search(name, number_of_own_descriptors);
cache->Update(map, name, number);
}
return number;
}
......
......@@ -113,6 +113,7 @@ class DescriptorArray : public WeakFixedArray {
// Search the instance descriptors for given name.
INLINE(int Search(Name* name, int number_of_own_descriptors));
INLINE(int Search(Name* name, Map* map));
// As the above, but uses DescriptorLookupCache and updates it when
// necessary.
......
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