[runtime] Remove UND::DeleteKey and Shrink in DeleteProperty
Bug: Change-Id: Id05ac179899cfa802575c90ea1745375e2833825 Reviewed-on: https://chromium-review.googlesource.com/542617 Commit-Queue: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#46117}
This commit is contained in:
parent
d54ffadfda
commit
a1a05e5e86
@ -334,13 +334,8 @@ void UncacheTemplateInstantiation(Isolate* isolate, int serial_number,
|
||||
isolate->slow_template_instantiations_cache();
|
||||
int entry = cache->FindEntry(serial_number);
|
||||
DCHECK_NE(UnseededNumberDictionary::kNotFound, entry);
|
||||
Handle<Object> result =
|
||||
UnseededNumberDictionary::DeleteProperty(cache, entry);
|
||||
USE(result);
|
||||
DCHECK(result->IsTrue(isolate));
|
||||
auto new_cache = UnseededNumberDictionary::Shrink(cache);
|
||||
isolate->native_context()->set_slow_template_instantiations_cache(
|
||||
*new_cache);
|
||||
cache = UnseededNumberDictionary::DeleteEntry(cache, entry);
|
||||
isolate->native_context()->set_slow_template_instantiations_cache(*cache);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,9 @@ Handle<Code> CodeStub::GetCodeCopy(const FindAndReplacePattern& pattern) {
|
||||
void CodeStub::DeleteStubFromCacheForTesting() {
|
||||
Heap* heap = isolate_->heap();
|
||||
Handle<UnseededNumberDictionary> dict(heap->code_stubs());
|
||||
dict = UnseededNumberDictionary::DeleteKey(dict, GetKey());
|
||||
int entry = dict->FindEntry(GetKey());
|
||||
DCHECK_NE(UnseededNumberDictionary::kNotFound, entry);
|
||||
dict = UnseededNumberDictionary::DeleteEntry(dict, entry);
|
||||
heap->SetRootCodeStubs(*dict);
|
||||
}
|
||||
|
||||
|
@ -1418,11 +1418,8 @@ class DictionaryElementsAccessor
|
||||
// TODO(verwaest): Remove reliance on index in Shrink.
|
||||
Handle<SeededNumberDictionary> dict(
|
||||
SeededNumberDictionary::cast(obj->elements()));
|
||||
Handle<Object> result = SeededNumberDictionary::DeleteProperty(dict, entry);
|
||||
USE(result);
|
||||
DCHECK(result->IsTrue(dict->GetIsolate()));
|
||||
Handle<FixedArray> new_elements = SeededNumberDictionary::Shrink(dict);
|
||||
obj->set_elements(*new_elements);
|
||||
dict = SeededNumberDictionary::DeleteEntry(dict, entry);
|
||||
obj->set_elements(*dict);
|
||||
}
|
||||
|
||||
static bool HasAccessorsImpl(JSObject* holder,
|
||||
@ -3718,14 +3715,9 @@ class SlowSloppyArgumentsElementsAccessor
|
||||
Handle<SeededNumberDictionary> dict(
|
||||
SeededNumberDictionary::cast(elements->arguments()), isolate);
|
||||
int length = elements->parameter_map_length();
|
||||
Handle<Object> result =
|
||||
SeededNumberDictionary::DeleteProperty(dict, entry - length);
|
||||
USE(result);
|
||||
DCHECK(result->IsTrue(isolate));
|
||||
Handle<FixedArray> new_elements = SeededNumberDictionary::Shrink(dict);
|
||||
elements->set_arguments(*new_elements);
|
||||
dict = SeededNumberDictionary::DeleteEntry(dict, entry - length);
|
||||
elements->set_arguments(*dict);
|
||||
}
|
||||
|
||||
static void AddImpl(Handle<JSObject> object, uint32_t index,
|
||||
Handle<Object> value, PropertyAttributes attributes,
|
||||
uint32_t new_capacity) {
|
||||
|
@ -6046,9 +6046,8 @@ void JSReceiver::DeleteNormalizedProperty(Handle<JSReceiver> object,
|
||||
Handle<NameDictionary> dictionary(object->property_dictionary());
|
||||
DCHECK_NE(NameDictionary::kNotFound, entry);
|
||||
|
||||
NameDictionary::DeleteProperty(dictionary, entry);
|
||||
Handle<NameDictionary> new_properties = NameDictionary::Shrink(dictionary);
|
||||
object->set_properties(*new_properties);
|
||||
dictionary = NameDictionary::DeleteEntry(dictionary, entry);
|
||||
object->set_properties(*dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16219,17 +16218,17 @@ Dictionary<SeededNumberDictionary,
|
||||
template Object* Dictionary<
|
||||
NameDictionary, NameDictionaryShape>::SlowReverseLookup(Object* value);
|
||||
|
||||
template Handle<Object>
|
||||
Dictionary<NameDictionary, NameDictionaryShape>::DeleteProperty(
|
||||
template Handle<NameDictionary>
|
||||
Dictionary<NameDictionary, NameDictionaryShape>::DeleteEntry(
|
||||
Handle<NameDictionary>, int);
|
||||
|
||||
template Handle<Object>
|
||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape>::DeleteProperty(
|
||||
template Handle<SeededNumberDictionary>
|
||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape>::DeleteEntry(
|
||||
Handle<SeededNumberDictionary>, int);
|
||||
|
||||
template Handle<Object>
|
||||
template Handle<UnseededNumberDictionary>
|
||||
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape>::
|
||||
DeleteProperty(Handle<UnseededNumberDictionary>, int);
|
||||
DeleteEntry(Handle<UnseededNumberDictionary>, int);
|
||||
|
||||
template Handle<NameDictionary>
|
||||
HashTable<NameDictionary, NameDictionaryShape>::New(Isolate*, int,
|
||||
@ -17542,16 +17541,15 @@ Handle<Derived> Dictionary<Derived, Shape>::EnsureCapacity(
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
Handle<Object> Dictionary<Derived, Shape>::DeleteProperty(
|
||||
Handle<Derived> Dictionary<Derived, Shape>::DeleteEntry(
|
||||
Handle<Derived> dictionary, int entry) {
|
||||
Factory* factory = dictionary->GetIsolate()->factory();
|
||||
PropertyDetails details = dictionary->DetailsAt(entry);
|
||||
if (!details.IsConfigurable()) return factory->false_value();
|
||||
|
||||
DCHECK(Shape::kEntrySize != 3 ||
|
||||
dictionary->DetailsAt(entry).IsConfigurable());
|
||||
dictionary->SetEntry(
|
||||
entry, factory->the_hole_value(), factory->the_hole_value());
|
||||
dictionary->ElementRemoved();
|
||||
return factory->true_value();
|
||||
return Shrink(dictionary);
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
@ -17643,18 +17641,6 @@ void SeededNumberDictionary::UpdateMaxNumberKey(
|
||||
}
|
||||
}
|
||||
|
||||
Handle<UnseededNumberDictionary> UnseededNumberDictionary::DeleteKey(
|
||||
Handle<UnseededNumberDictionary> dictionary, uint32_t key) {
|
||||
int entry = dictionary->FindEntry(key);
|
||||
if (entry == kNotFound) return dictionary;
|
||||
|
||||
Factory* factory = dictionary->GetIsolate()->factory();
|
||||
dictionary->SetEntry(entry, factory->the_hole_value(),
|
||||
factory->the_hole_value());
|
||||
dictionary->ElementRemoved();
|
||||
return dictionary->Shrink(dictionary);
|
||||
}
|
||||
|
||||
Handle<SeededNumberDictionary> SeededNumberDictionary::Set(
|
||||
Handle<SeededNumberDictionary> dictionary, uint32_t key,
|
||||
Handle<Object> value, Handle<JSObject> dictionary_holder,
|
||||
|
@ -53,7 +53,8 @@ class Dictionary : public HashTable<Derived, Shape> {
|
||||
}
|
||||
|
||||
// Delete a property from the dictionary.
|
||||
static Handle<Object> DeleteProperty(Handle<Derived> dictionary, int entry);
|
||||
MUST_USE_RESULT static Handle<Derived> DeleteEntry(Handle<Derived> dictionary,
|
||||
int entry);
|
||||
|
||||
// Attempt to shrink the dictionary after deletion of key.
|
||||
MUST_USE_RESULT static inline Handle<Derived> Shrink(
|
||||
@ -323,8 +324,6 @@ class UnseededNumberDictionary
|
||||
MUST_USE_RESULT static Handle<UnseededNumberDictionary> Set(
|
||||
Handle<UnseededNumberDictionary> dictionary, uint32_t key,
|
||||
Handle<Object> value);
|
||||
static Handle<UnseededNumberDictionary> DeleteKey(
|
||||
Handle<UnseededNumberDictionary> dictionary, uint32_t key);
|
||||
|
||||
static const int kEntryValueIndex = 1;
|
||||
static const int kEntryDetailsIndex = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user