[runtime] pass in the Isolate into SearchWithCache

BUG=

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

Cr-Commit-Position: refs/heads/master@{#34087}
This commit is contained in:
verwaest 2016-02-17 08:23:38 -08:00 committed by Commit bot
parent c383fc20ca
commit f3f6b03a75
9 changed files with 14 additions and 13 deletions

View File

@ -99,7 +99,7 @@ bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map,
// Check if the property is overridden on the instance.
DescriptorArray* descriptors = map->instance_descriptors();
int descriptor = descriptors->SearchWithCache(*name, *map);
int descriptor = descriptors->SearchWithCache(isolate, *name, *map);
if (descriptor != DescriptorArray::kNotFound) return false;
Handle<Object> proto = Handle<Object>(map->prototype(), isolate);

View File

@ -825,7 +825,7 @@ static void ReplaceAccessors(Handle<Map> map,
PropertyAttributes attributes,
Handle<AccessorPair> accessor_pair) {
DescriptorArray* descriptors = map->instance_descriptors();
int idx = descriptors->SearchWithCache(*name, *map);
int idx = descriptors->SearchWithCache(map->GetIsolate(), *name, *map);
AccessorConstantDescriptor descriptor(name, accessor_pair, attributes);
descriptors->Replace(idx, &descriptor);
}
@ -2903,7 +2903,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
array_function->initial_map()->instance_descriptors());
Handle<String> length = factory()->length_string();
int old = array_descriptors->SearchWithCache(
*length, array_function->initial_map());
isolate(), *length, array_function->initial_map());
DCHECK(old != DescriptorArray::kNotFound);
AccessorConstantDescriptor desc(
length, handle(array_descriptors->GetValue(old), isolate()),

View File

@ -242,7 +242,7 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
do {
// Lookup the named property on the {map}.
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate());
int const number = descriptors->SearchWithCache(*name, *map);
int const number = descriptors->SearchWithCache(isolate(), *name, *map);
if (number != DescriptorArray::kNotFound) {
PropertyDetails const details = descriptors->GetDetails(number);
if (access_mode == AccessMode::kStore) {

View File

@ -8783,7 +8783,8 @@ bool HOptimizedGraphBuilder::IsReadOnlyLengthDescriptor(
Isolate* isolate = jsarray_map->GetIsolate();
Handle<Name> length_string = isolate->factory()->length_string();
DescriptorArray* descriptors = jsarray_map->instance_descriptors();
int number = descriptors->SearchWithCache(*length_string, *jsarray_map);
int number =
descriptors->SearchWithCache(isolate, *length_string, *jsarray_map);
DCHECK_NE(DescriptorArray::kNotFound, number);
return descriptors->GetDetails(number).IsReadOnly();
}

View File

@ -2632,7 +2632,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
void LookupDescriptor(Map* map, Name* name) {
DescriptorArray* descriptors = map->instance_descriptors();
int number = descriptors->SearchWithCache(name, map);
int number = descriptors->SearchWithCache(isolate(), name, map);
if (number == DescriptorArray::kNotFound) return NotFound();
lookup_type_ = DESCRIPTOR_TYPE;
details_ = descriptors->GetDetails(number);

View File

@ -630,7 +630,7 @@ LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
property_details_ = accessor->GetDetails(js_object, number_);
} else if (!map->is_dictionary_map()) {
DescriptorArray* descriptors = map->instance_descriptors();
int number = descriptors->SearchWithCache(*name_, map);
int number = descriptors->SearchWithCache(isolate_, *name_, map);
if (number == DescriptorArray::kNotFound) return NotFound(holder);
number_ = static_cast<uint32_t>(number);
property_details_ = descriptors->GetDetails(number_);

View File

@ -2650,12 +2650,11 @@ int DescriptorArray::Search(Name* name, int valid_descriptors) {
return internal::Search<VALID_ENTRIES>(this, name, valid_descriptors, NULL);
}
int DescriptorArray::SearchWithCache(Name* name, Map* map) {
int DescriptorArray::SearchWithCache(Isolate* isolate, Name* name, Map* map) {
int number_of_own_descriptors = map->NumberOfOwnDescriptors();
if (number_of_own_descriptors == 0) return kNotFound;
DescriptorLookupCache* cache = GetIsolate()->descriptor_lookup_cache();
DescriptorLookupCache* cache = isolate->descriptor_lookup_cache();
int number = cache->Lookup(map, name);
if (number == DescriptorLookupCache::kAbsent) {

View File

@ -9979,7 +9979,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Handle<Map> map,
Handle<AccessorPair> pair;
DescriptorArray* old_descriptors = map->instance_descriptors();
int descriptor = old_descriptors->SearchWithCache(*name, *map);
int descriptor = old_descriptors->SearchWithCache(isolate, *name, *map);
if (descriptor != DescriptorArray::kNotFound) {
if (descriptor != map->LastAdded()) {
return Map::Normalize(map, mode, "AccessorsOverwritingNonLast");
@ -10060,7 +10060,8 @@ Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map,
descriptor->KeyToUniqueName();
// We replace the key if it is already present.
int index = old_descriptors->SearchWithCache(*descriptor->GetKey(), *map);
int index = old_descriptors->SearchWithCache(map->GetIsolate(),
*descriptor->GetKey(), *map);
if (index != DescriptorArray::kNotFound) {
return CopyReplaceDescriptor(map, old_descriptors, descriptor, index, flag);
}

View File

@ -3001,7 +3001,7 @@ class DescriptorArray: public FixedArray {
// As the above, but uses DescriptorLookupCache and updates it when
// necessary.
INLINE(int SearchWithCache(Name* name, Map* map));
INLINE(int SearchWithCache(Isolate* isolate, Name* name, Map* map));
bool IsEqualUpTo(DescriptorArray* desc, int nof_descriptors);