| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index f8939660acc4ba7c214f9a26bb7249213a948fe7..ad4fa9582de65d5eb5bbe35c5ae94644199daa87 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -11024,39 +11024,62 @@ template class HashTable<ObjectHashTableShape<2>, Object*>;
|
|
|
| template class Dictionary<StringDictionaryShape, String*>;
|
|
|
| -template class Dictionary<NumberDictionaryShape, uint32_t>;
|
| +template class Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>;
|
|
|
| -template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Allocate(
|
| - int);
|
| +template class Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>;
|
| +
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + Allocate(int);
|
| +
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + Allocate(int);
|
|
|
| template MaybeObject* Dictionary<StringDictionaryShape, String*>::Allocate(
|
| int);
|
|
|
| -template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::AtPut(
|
| - uint32_t, Object*);
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + AtPut(uint32_t, Object*);
|
|
|
| -template Object* Dictionary<NumberDictionaryShape, uint32_t>::SlowReverseLookup(
|
| - Object*);
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + AtPut(uint32_t, Object*);
|
| +
|
| +template Object* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + SlowReverseLookup(Object*);
|
| +
|
| +template Object* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + SlowReverseLookup(Object*);
|
|
|
| template Object* Dictionary<StringDictionaryShape, String*>::SlowReverseLookup(
|
| Object*);
|
|
|
| -template void Dictionary<NumberDictionaryShape, uint32_t>::CopyKeysTo(
|
| - FixedArray*,
|
| - PropertyAttributes,
|
| - Dictionary<NumberDictionaryShape, uint32_t>::SortMode);
|
| +template void Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + CopyKeysTo(FixedArray*,
|
| + PropertyAttributes,
|
| + Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::SortMode);
|
| +
|
| +template void Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + CopyKeysTo(
|
| + FixedArray*,
|
| + PropertyAttributes,
|
| + Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::SortMode);
|
|
|
| template Object* Dictionary<StringDictionaryShape, String*>::DeleteProperty(
|
| int, JSObject::DeleteMode);
|
|
|
| -template Object* Dictionary<NumberDictionaryShape, uint32_t>::DeleteProperty(
|
| - int, JSObject::DeleteMode);
|
| +template Object* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + DeleteProperty(int, JSObject::DeleteMode);
|
| +
|
| +template Object* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + DeleteProperty(int, JSObject::DeleteMode);
|
|
|
| template MaybeObject* Dictionary<StringDictionaryShape, String*>::Shrink(
|
| String*);
|
|
|
| -template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Shrink(
|
| - uint32_t);
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + Shrink(uint32_t);
|
| +
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + Shrink(uint32_t);
|
|
|
| template void Dictionary<StringDictionaryShape, String*>::CopyKeysTo(
|
| FixedArray*,
|
| @@ -11074,32 +11097,53 @@ template MaybeObject*
|
| Dictionary<StringDictionaryShape, String*>::GenerateNewEnumerationIndices();
|
|
|
| template int
|
| -Dictionary<NumberDictionaryShape, uint32_t>::NumberOfElementsFilterAttributes(
|
| - PropertyAttributes);
|
| +Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + NumberOfElementsFilterAttributes(PropertyAttributes);
|
|
|
| -template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Add(
|
| +template int
|
| +Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + NumberOfElementsFilterAttributes(PropertyAttributes);
|
| +
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::Add(
|
| uint32_t, Object*, PropertyDetails);
|
|
|
| -template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + Add(uint32_t, Object*, PropertyDetails);
|
| +
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + EnsureCapacity(int, uint32_t);
|
| +
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| EnsureCapacity(int, uint32_t);
|
|
|
| template MaybeObject* Dictionary<StringDictionaryShape, String*>::
|
| EnsureCapacity(int, String*);
|
|
|
| -template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::AddEntry(
|
| - uint32_t, Object*, PropertyDetails, uint32_t);
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
|
| +
|
| +template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
|
|
|
| template MaybeObject* Dictionary<StringDictionaryShape, String*>::AddEntry(
|
| String*, Object*, PropertyDetails, uint32_t);
|
|
|
| template
|
| -int Dictionary<NumberDictionaryShape, uint32_t>::NumberOfEnumElements();
|
| +int Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::
|
| + NumberOfEnumElements();
|
| +
|
| +template
|
| +int Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::
|
| + NumberOfEnumElements();
|
|
|
| template
|
| int Dictionary<StringDictionaryShape, String*>::NumberOfEnumElements();
|
|
|
| template
|
| -int HashTable<NumberDictionaryShape, uint32_t>::FindEntry(uint32_t);
|
| +int HashTable<NumberDictionaryShape<kSeeded>, uint32_t>::FindEntry(uint32_t);
|
| +
|
| +template
|
| +int HashTable<NumberDictionaryShape<kNotSeeded>, uint32_t>::FindEntry(uint32_t);
|
|
|
|
|
| // Collates undefined and unexisting elements below limit from position
|
| @@ -12064,7 +12108,7 @@ MaybeObject* Dictionary<Shape, Key>::AddEntry(Key key,
|
| }
|
|
|
|
|
| -void NumberDictionary::UpdateMaxNumberKey(uint32_t key) {
|
| +void NumberDictionaryBase::UpdateMaxNumberKey(uint32_t key) {
|
| // If the dictionary requires slow elements an element has already
|
| // been added at a high index.
|
| if (requires_slow_elements()) return;
|
| @@ -12075,26 +12119,47 @@ void NumberDictionary::UpdateMaxNumberKey(uint32_t key) {
|
| return;
|
| }
|
| // Update max key value.
|
| - Object* max_index_object = get(kMaxNumberKeyIndex);
|
| + Object* max_index_object = as_dict()->get(
|
| + NumberDictionary::kMaxNumberKeyIndex);
|
| if (!max_index_object->IsSmi() || max_number_key() < key) {
|
| - FixedArray::set(kMaxNumberKeyIndex,
|
| - Smi::FromInt(key << kRequiresSlowElementsTagSize));
|
| + as_dict()->set(NumberDictionary::kMaxNumberKeyIndex,
|
| + Smi::FromInt(key << kRequiresSlowElementsTagSize));
|
| }
|
| }
|
|
|
|
|
| -MaybeObject* NumberDictionary::AddNumberEntry(uint32_t key,
|
| - Object* value,
|
| - PropertyDetails details) {
|
| +MaybeObject* NumberDictionaryBase::AddNumberEntry(uint32_t key,
|
| + Object* value,
|
| + PropertyDetails details) {
|
| UpdateMaxNumberKey(key);
|
| - SLOW_ASSERT(this->FindEntry(key) == kNotFound);
|
| - return Add(key, value, details);
|
| + SLOW_ASSERT(as_dict()->FindEntry(key) == NumberDictionary::kNotFound);
|
| + return as_dict()->Add(key, value, details);
|
| }
|
|
|
|
|
| -MaybeObject* NumberDictionary::AtNumberPut(uint32_t key, Object* value) {
|
| +MaybeObject* NumberDictionaryBase::AtNumberPut(uint32_t key, Object* value) {
|
| UpdateMaxNumberKey(key);
|
| - return AtPut(key, value);
|
| + return as_dict()->AtPut(key, value);
|
| +}
|
| +
|
| +
|
| +MaybeObject* NumberDictionaryBase::Set(uint32_t key,
|
| + Object* value,
|
| + PropertyDetails details) {
|
| + int entry = as_dict()->FindEntry(key);
|
| + if (entry == NumberDictionary::kNotFound) {
|
| + return AddNumberEntry(key, value, details);
|
| + }
|
| +
|
| + // Preserve enumeration index.
|
| + details = PropertyDetails(details.attributes(),
|
| + details.type(),
|
| + as_dict()->DetailsAt(entry).index());
|
| + MaybeObject* maybe_object_key = NumberDictionaryShape<kSeeded>::AsObject(key);
|
| + Object* object_key;
|
| + if (!maybe_object_key->ToObject(&object_key)) return maybe_object_key;
|
| + as_dict()->SetEntry(entry, object_key, value, details);
|
| + return as_dict();
|
| }
|
|
|
|
|
| @@ -12109,24 +12174,17 @@ Handle<NumberDictionary> NumberDictionary::Set(
|
| }
|
|
|
|
|
| -MaybeObject* NumberDictionary::Set(uint32_t key,
|
| - Object* value,
|
| - PropertyDetails details) {
|
| - int entry = FindEntry(key);
|
| - if (entry == kNotFound) return AddNumberEntry(key, value, details);
|
| - // Preserve enumeration index.
|
| - details = PropertyDetails(details.attributes(),
|
| - details.type(),
|
| - DetailsAt(entry).index());
|
| - MaybeObject* maybe_object_key = NumberDictionaryShape::AsObject(key);
|
| - Object* object_key;
|
| - if (!maybe_object_key->ToObject(&object_key)) return maybe_object_key;
|
| - SetEntry(entry, object_key, value, details);
|
| - return this;
|
| +Handle<NotSeededNumberDictionary> NotSeededNumberDictionary::Set(
|
| + Handle<NotSeededNumberDictionary> dictionary,
|
| + uint32_t index,
|
| + Handle<Object> value,
|
| + PropertyDetails details) {
|
| + CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
|
| + dictionary->Set(index, *value, details),
|
| + NotSeededNumberDictionary);
|
| }
|
|
|
|
|
| -
|
| template<typename Shape, typename Key>
|
| int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes(
|
| PropertyAttributes filter) {
|
|
|