Index: src/objects.cc |
=================================================================== |
--- src/objects.cc (revision 10405) |
+++ src/objects.cc (working copy) |
@@ -1951,9 +1951,10 @@ |
if (!JSObject::cast(pt)->HasDictionaryElements()) { |
continue; |
} |
- NumberDictionary* dictionary = JSObject::cast(pt)->element_dictionary(); |
+ SeededNumberDictionary* dictionary = |
+ JSObject::cast(pt)->element_dictionary(); |
int entry = dictionary->FindEntry(index); |
- if (entry != NumberDictionary::kNotFound) { |
+ if (entry != SeededNumberDictionary::kNotFound) { |
PropertyDetails details = dictionary->DetailsAt(entry); |
if (details.type() == CALLBACKS) { |
*found = true; |
@@ -2928,11 +2929,11 @@ |
int old_capacity = 0; |
int used_elements = 0; |
GetElementsCapacityAndUsage(&old_capacity, &used_elements); |
- NumberDictionary* dictionary = NULL; |
+ SeededNumberDictionary* dictionary = NULL; |
{ Object* object; |
- MaybeObject* maybe = NumberDictionary::Allocate(used_elements); |
+ MaybeObject* maybe = SeededNumberDictionary::Allocate(used_elements); |
if (!maybe->ToObject(&object)) return maybe; |
- dictionary = NumberDictionary::cast(object); |
+ dictionary = SeededNumberDictionary::cast(object); |
} |
// Copy the elements to the new backing store. |
@@ -2962,7 +2963,7 @@ |
MaybeObject* maybe_result = |
dictionary->AddNumberEntry(i, value, details); |
if (!maybe_result->ToObject(&result)) return maybe_result; |
- dictionary = NumberDictionary::cast(result); |
+ dictionary = SeededNumberDictionary::cast(result); |
} |
} |
@@ -3277,7 +3278,8 @@ |
if (!element->IsTheHole() && element == object) return true; |
} |
} else { |
- Object* key = NumberDictionary::cast(elements)->SlowReverseLookup(object); |
+ Object* key = |
+ SeededNumberDictionary::cast(elements)->SlowReverseLookup(object); |
if (!key->IsUndefined()) return true; |
} |
return false; |
@@ -3416,9 +3418,9 @@ |
} |
// If there are fast elements we normalize. |
- NumberDictionary* dictionary = NULL; |
+ SeededNumberDictionary* dictionary = NULL; |
{ MaybeObject* maybe = NormalizeElements(); |
- if (!maybe->To<NumberDictionary>(&dictionary)) return maybe; |
+ if (!maybe->To<SeededNumberDictionary>(&dictionary)) return maybe; |
} |
ASSERT(HasDictionaryElements() || HasDictionaryArgumentsElements()); |
// Make sure that we never go back to fast case. |
@@ -3581,11 +3583,11 @@ |
// undefined if the element is read-only, or the getter/setter pair (fixed |
// array) if there is an existing one, or the hole value if the element does |
// not exist or is a normal non-getter/setter data element. |
-static Object* FindGetterSetterInDictionary(NumberDictionary* dictionary, |
+static Object* FindGetterSetterInDictionary(SeededNumberDictionary* dictionary, |
uint32_t index, |
Heap* heap) { |
int entry = dictionary->FindEntry(index); |
- if (entry != NumberDictionary::kNotFound) { |
+ if (entry != SeededNumberDictionary::kNotFound) { |
Object* result = dictionary->ValueAt(entry); |
PropertyDetails details = dictionary->DetailsAt(entry); |
if (details.IsReadOnly()) return heap->undefined_value(); |
@@ -3647,7 +3649,8 @@ |
if (probe == NULL || probe->IsTheHole()) { |
FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
if (arguments->IsDictionary()) { |
- NumberDictionary* dictionary = NumberDictionary::cast(arguments); |
+ SeededNumberDictionary* dictionary = |
+ SeededNumberDictionary::cast(arguments); |
probe = FindGetterSetterInDictionary(dictionary, index, heap); |
if (!probe->IsTheHole()) return probe; |
} |
@@ -3716,11 +3719,11 @@ |
PropertyDetails details = PropertyDetails(attributes, CALLBACKS); |
// Normalize elements to make this operation simple. |
- NumberDictionary* dictionary = NULL; |
+ SeededNumberDictionary* dictionary = NULL; |
{ Object* result; |
MaybeObject* maybe = NormalizeElements(); |
if (!maybe->ToObject(&result)) return maybe; |
- dictionary = NumberDictionary::cast(result); |
+ dictionary = SeededNumberDictionary::cast(result); |
} |
ASSERT(HasDictionaryElements() || HasDictionaryArgumentsElements()); |
@@ -3728,7 +3731,7 @@ |
{ Object* result; |
MaybeObject* maybe = dictionary->Set(index, structure, details); |
if (!maybe->ToObject(&result)) return maybe; |
- dictionary = NumberDictionary::cast(result); |
+ dictionary = SeededNumberDictionary::cast(result); |
} |
dictionary->set_requires_slow_elements(); |
@@ -3933,9 +3936,9 @@ |
obj = JSObject::cast(obj)->GetPrototype()) { |
JSObject* js_object = JSObject::cast(obj); |
if (js_object->HasDictionaryElements()) { |
- NumberDictionary* dictionary = js_object->element_dictionary(); |
+ SeededNumberDictionary* dictionary = js_object->element_dictionary(); |
int entry = dictionary->FindEntry(index); |
- if (entry != NumberDictionary::kNotFound) { |
+ if (entry != SeededNumberDictionary::kNotFound) { |
Object* element = dictionary->ValueAt(entry); |
PropertyDetails details = dictionary->DetailsAt(entry); |
if (details.type() == CALLBACKS) { |
@@ -6077,14 +6080,14 @@ |
if (StringShape(this).IsSequentialAscii()) { |
field = HashSequentialString(SeqAsciiString::cast(this)->GetChars(), |
len, |
- GetHeap()->StringHashSeed()); |
+ GetHeap()->HashSeed()); |
} else if (StringShape(this).IsSequentialTwoByte()) { |
field = HashSequentialString(SeqTwoByteString::cast(this)->GetChars(), |
len, |
- GetHeap()->StringHashSeed()); |
+ GetHeap()->HashSeed()); |
} else { |
StringInputBuffer buffer(this); |
- field = ComputeHashField(&buffer, len, GetHeap()->StringHashSeed()); |
+ field = ComputeHashField(&buffer, len, GetHeap()->HashSeed()); |
} |
// Store the hash code in the object. |
@@ -7276,7 +7279,7 @@ |
} |
-static void CopySlowElementsToFast(NumberDictionary* source, |
+static void CopySlowElementsToFast(SeededNumberDictionary* source, |
FixedArray* destination, |
WriteBarrierMode mode) { |
for (int i = 0; i < source->Capacity(); ++i) { |
@@ -7324,7 +7327,7 @@ |
case DICTIONARY_ELEMENTS: { |
AssertNoAllocation no_gc; |
WriteBarrierMode mode = new_elements->GetWriteBarrierMode(no_gc); |
- CopySlowElementsToFast(NumberDictionary::cast(elements()), |
+ CopySlowElementsToFast(SeededNumberDictionary::cast(elements()), |
new_elements, |
mode); |
set_map(new_map); |
@@ -7339,7 +7342,7 @@ |
FixedArray* parameter_map = FixedArray::cast(elements()); |
FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
if (arguments->IsDictionary()) { |
- CopySlowElementsToFast(NumberDictionary::cast(arguments), |
+ CopySlowElementsToFast(SeededNumberDictionary::cast(arguments), |
new_elements, |
mode); |
} else { |
@@ -7426,7 +7429,7 @@ |
break; |
} |
case DICTIONARY_ELEMENTS: { |
- elems->Initialize(NumberDictionary::cast(elements())); |
+ elems->Initialize(SeededNumberDictionary::cast(elements())); |
break; |
} |
default: |
@@ -7861,7 +7864,7 @@ |
} |
case DICTIONARY_ELEMENTS: { |
if (element_dictionary()->FindEntry(index) |
- != NumberDictionary::kNotFound) { |
+ != SeededNumberDictionary::kNotFound) { |
return true; |
} |
break; |
@@ -7993,7 +7996,7 @@ |
} |
case DICTIONARY_ELEMENTS: { |
if (element_dictionary()->FindEntry(index) != |
- NumberDictionary::kNotFound) { |
+ SeededNumberDictionary::kNotFound) { |
return DICTIONARY_ELEMENT; |
} |
break; |
@@ -8010,8 +8013,9 @@ |
// If not aliased, check the arguments. |
FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
if (arguments->IsDictionary()) { |
- NumberDictionary* dictionary = NumberDictionary::cast(arguments); |
- if (dictionary->FindEntry(index) != NumberDictionary::kNotFound) { |
+ SeededNumberDictionary* dictionary = |
+ SeededNumberDictionary::cast(arguments); |
+ if (dictionary->FindEntry(index) != SeededNumberDictionary::kNotFound) { |
return DICTIONARY_ELEMENT; |
} |
} else { |
@@ -8040,8 +8044,8 @@ |
return true; |
} |
} else { |
- if (NumberDictionary::cast(elements)->FindEntry(index) != |
- NumberDictionary::kNotFound) { |
+ if (SeededNumberDictionary::cast(elements)->FindEntry(index) != |
+ SeededNumberDictionary::kNotFound) { |
return true; |
} |
} |
@@ -8107,7 +8111,7 @@ |
} |
case DICTIONARY_ELEMENTS: { |
if (element_dictionary()->FindEntry(index) |
- != NumberDictionary::kNotFound) { |
+ != SeededNumberDictionary::kNotFound) { |
return true; |
} |
break; |
@@ -8387,15 +8391,15 @@ |
FixedArray* elements = FixedArray::cast(this->elements()); |
bool is_arguments = |
(elements->map() == heap->non_strict_arguments_elements_map()); |
- NumberDictionary* dictionary = NULL; |
+ SeededNumberDictionary* dictionary = NULL; |
if (is_arguments) { |
- dictionary = NumberDictionary::cast(elements->get(1)); |
+ dictionary = SeededNumberDictionary::cast(elements->get(1)); |
} else { |
- dictionary = NumberDictionary::cast(elements); |
+ dictionary = SeededNumberDictionary::cast(elements); |
} |
int entry = dictionary->FindEntry(index); |
- if (entry != NumberDictionary::kNotFound) { |
+ if (entry != SeededNumberDictionary::kNotFound) { |
Object* element = dictionary->ValueAt(entry); |
PropertyDetails details = dictionary->DetailsAt(entry); |
if (details.type() == CALLBACKS) { |
@@ -8440,13 +8444,13 @@ |
FixedArrayBase* new_dictionary; |
MaybeObject* maybe = dictionary->AtNumberPut(index, value); |
if (!maybe->To<FixedArrayBase>(&new_dictionary)) return maybe; |
- if (dictionary != NumberDictionary::cast(new_dictionary)) { |
+ if (dictionary != SeededNumberDictionary::cast(new_dictionary)) { |
if (is_arguments) { |
elements->set(1, new_dictionary); |
} else { |
set_elements(new_dictionary); |
} |
- dictionary = NumberDictionary::cast(new_dictionary); |
+ dictionary = SeededNumberDictionary::cast(new_dictionary); |
} |
} |
@@ -8767,7 +8771,8 @@ |
FixedArray::cast(FixedArray::cast(backing_store_base)->get(1)); |
backing_store = FixedArray::cast(backing_store_base); |
if (backing_store->IsDictionary()) { |
- NumberDictionary* dictionary = NumberDictionary::cast(backing_store); |
+ SeededNumberDictionary* dictionary = |
+ SeededNumberDictionary::cast(backing_store); |
*capacity = dictionary->Capacity(); |
*used = dictionary->NumberOfElements(); |
break; |
@@ -8781,8 +8786,8 @@ |
} |
break; |
case DICTIONARY_ELEMENTS: { |
- NumberDictionary* dictionary = |
- NumberDictionary::cast(FixedArray::cast(elements())); |
+ SeededNumberDictionary* dictionary = |
+ SeededNumberDictionary::cast(FixedArray::cast(elements())); |
*capacity = dictionary->Capacity(); |
*used = dictionary->NumberOfElements(); |
break; |
@@ -8827,8 +8832,8 @@ |
int old_capacity = 0; |
int used_elements = 0; |
GetElementsCapacityAndUsage(&old_capacity, &used_elements); |
- int dictionary_size = NumberDictionary::ComputeCapacity(used_elements) * |
- NumberDictionary::kEntrySize; |
+ int dictionary_size = SeededNumberDictionary::ComputeCapacity(used_elements) * |
+ SeededNumberDictionary::kEntrySize; |
return 3 * dictionary_size <= new_capacity; |
} |
@@ -8842,11 +8847,11 @@ |
if (IsAccessCheckNeeded()) return false; |
FixedArray* elements = FixedArray::cast(this->elements()); |
- NumberDictionary* dictionary = NULL; |
+ SeededNumberDictionary* dictionary = NULL; |
if (elements->map() == GetHeap()->non_strict_arguments_elements_map()) { |
- dictionary = NumberDictionary::cast(elements->get(1)); |
+ dictionary = SeededNumberDictionary::cast(elements->get(1)); |
} else { |
- dictionary = NumberDictionary::cast(elements); |
+ dictionary = SeededNumberDictionary::cast(elements); |
} |
// If an element has been added at a very high index in the elements |
// dictionary, we cannot go back to fast case. |
@@ -8861,7 +8866,7 @@ |
array_size = dictionary->max_number_key(); |
} |
uint32_t dictionary_size = static_cast<uint32_t>(dictionary->Capacity()) * |
- NumberDictionary::kEntrySize; |
+ SeededNumberDictionary::kEntrySize; |
return 2 * dictionary_size >= array_size; |
} |
@@ -8869,7 +8874,8 @@ |
bool JSObject::CanConvertToFastDoubleElements() { |
if (FLAG_unbox_double_arrays) { |
ASSERT(HasDictionaryElements()); |
- NumberDictionary* dictionary = NumberDictionary::cast(elements()); |
+ SeededNumberDictionary* dictionary = |
+ SeededNumberDictionary::cast(elements()); |
for (int i = 0; i < dictionary->Capacity(); i++) { |
Object* key = dictionary->KeyAt(i); |
if (key->IsNumber()) { |
@@ -9082,7 +9088,7 @@ |
} |
case DICTIONARY_ELEMENTS: { |
return element_dictionary()->FindEntry(index) |
- != NumberDictionary::kNotFound; |
+ != SeededNumberDictionary::kNotFound; |
} |
case NON_STRICT_ARGUMENTS_ELEMENTS: |
UNIMPLEMENTED(); |
@@ -9350,7 +9356,7 @@ |
if (storage != NULL) { |
element_dictionary()->CopyKeysTo(storage, |
filter, |
- NumberDictionary::SORTED); |
+ SeededNumberDictionary::SORTED); |
} |
counter += element_dictionary()->NumberOfElementsFilterAttributes(filter); |
break; |
@@ -9362,9 +9368,11 @@ |
if (arguments->IsDictionary()) { |
// Copy the keys from arguments first, because Dictionary::CopyKeysTo |
// will insert in storage starting at index 0. |
- NumberDictionary* dictionary = NumberDictionary::cast(arguments); |
+ SeededNumberDictionary* dictionary = |
+ SeededNumberDictionary::cast(arguments); |
if (storage != NULL) { |
- dictionary->CopyKeysTo(storage, filter, NumberDictionary::UNSORTED); |
+ dictionary->CopyKeysTo( |
+ storage, filter, SeededNumberDictionary::UNSORTED); |
} |
counter += dictionary->NumberOfElementsFilterAttributes(filter); |
for (int i = 0; i < mapped_length; ++i) { |
@@ -9671,7 +9679,7 @@ |
uint32_t Hash() { |
ASSERT(length_ >= 0); |
ASSERT(from_ + length_ <= string_->length()); |
- StringHasher hasher(length_, string_->GetHeap()->StringHashSeed()); |
+ StringHasher hasher(length_, string_->GetHeap()->HashSeed()); |
// Very long strings have a trivial hash that doesn't inspect the |
// string contents. |
@@ -9880,7 +9888,7 @@ |
uint32_t from_index = EntryToIndex(i); |
Object* k = get(from_index); |
if (IsKey(k)) { |
- uint32_t hash = Shape::HashForObject(key, k); |
+ uint32_t hash = HashTable<Shape, Key>::HashForObject(key, k); |
uint32_t insertion_index = |
EntryToIndex(new_table->FindInsertionEntry(hash)); |
for (int j = 0; j < Shape::kEntrySize; j++) { |
@@ -9976,38 +9984,46 @@ |
template class Dictionary<StringDictionaryShape, String*>; |
-template class Dictionary<NumberDictionaryShape, uint32_t>; |
+template class Dictionary<SeededNumberDictionaryShape, uint32_t>; |
-template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Allocate( |
- int); |
+template class Dictionary<UnseededNumberDictionaryShape, uint32_t>; |
+template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>:: |
+ Allocate(int at_least_space_for); |
+ |
+template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>:: |
+ Allocate(int at_least_space_for); |
+ |
template MaybeObject* Dictionary<StringDictionaryShape, String*>::Allocate( |
int); |
-template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::AtPut( |
+template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::AtPut( |
uint32_t, Object*); |
-template Object* Dictionary<NumberDictionaryShape, uint32_t>::SlowReverseLookup( |
- Object*); |
+template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>:: |
+ AtPut(uint32_t, Object*); |
+template Object* Dictionary<UnseededNumberDictionaryShape, uint32_t>:: |
+ SlowReverseLookup(Object* value); |
+ |
template Object* Dictionary<StringDictionaryShape, String*>::SlowReverseLookup( |
Object*); |
-template void Dictionary<NumberDictionaryShape, uint32_t>::CopyKeysTo( |
+template void Dictionary<SeededNumberDictionaryShape, uint32_t>::CopyKeysTo( |
FixedArray*, |
PropertyAttributes, |
- Dictionary<NumberDictionaryShape, uint32_t>::SortMode); |
+ Dictionary<SeededNumberDictionaryShape, 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<SeededNumberDictionaryShape, uint32_t>:: |
+ DeleteProperty(int, JSObject::DeleteMode); |
template MaybeObject* Dictionary<StringDictionaryShape, String*>::Shrink( |
String*); |
-template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Shrink( |
+template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::Shrink( |
uint32_t); |
template void Dictionary<StringDictionaryShape, String*>::CopyKeysTo( |
@@ -10026,32 +10042,41 @@ |
Dictionary<StringDictionaryShape, String*>::GenerateNewEnumerationIndices(); |
template int |
-Dictionary<NumberDictionaryShape, uint32_t>::NumberOfElementsFilterAttributes( |
- PropertyAttributes); |
+Dictionary<SeededNumberDictionaryShape, uint32_t>:: |
+ NumberOfElementsFilterAttributes(PropertyAttributes); |
-template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Add( |
+template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::Add( |
uint32_t, Object*, PropertyDetails); |
-template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>:: |
+template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::Add( |
+ uint32_t, Object*, PropertyDetails); |
+ |
+template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>:: |
EnsureCapacity(int, uint32_t); |
+template MaybeObject* Dictionary<UnseededNumberDictionaryShape, 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<SeededNumberDictionaryShape, uint32_t>:: |
+ AddEntry(uint32_t, Object*, PropertyDetails, uint32_t); |
+template MaybeObject* Dictionary<UnseededNumberDictionaryShape, 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<SeededNumberDictionaryShape, uint32_t>::NumberOfEnumElements(); |
template |
int Dictionary<StringDictionaryShape, String*>::NumberOfEnumElements(); |
template |
-int HashTable<NumberDictionaryShape, uint32_t>::FindEntry(uint32_t); |
+int HashTable<SeededNumberDictionaryShape, uint32_t>::FindEntry(uint32_t); |
// Collates undefined and unexisting elements below limit from position |
@@ -10061,7 +10086,7 @@ |
// Must stay in dictionary mode, either because of requires_slow_elements, |
// or because we are not going to sort (and therefore compact) all of the |
// elements. |
- NumberDictionary* dict = element_dictionary(); |
+ SeededNumberDictionary* dict = element_dictionary(); |
HeapNumber* result_double = NULL; |
if (limit > static_cast<uint32_t>(Smi::kMaxValue)) { |
// Allocate space for result before we start mutating the object. |
@@ -10074,10 +10099,10 @@ |
Object* obj; |
{ MaybeObject* maybe_obj = |
- NumberDictionary::Allocate(dict->NumberOfElements()); |
+ SeededNumberDictionary::Allocate(dict->NumberOfElements()); |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
} |
- NumberDictionary* new_dict = NumberDictionary::cast(obj); |
+ SeededNumberDictionary* new_dict = SeededNumberDictionary::cast(obj); |
AssertNoAllocation no_alloc; |
@@ -10163,7 +10188,7 @@ |
if (HasDictionaryElements()) { |
// Convert to fast elements containing only the existing properties. |
// Ordering is irrelevant, since we are going to sort anyway. |
- NumberDictionary* dict = element_dictionary(); |
+ SeededNumberDictionary* dict = element_dictionary(); |
if (IsJSArray() || dict->requires_slow_elements() || |
dict->max_number_key() >= limit) { |
return PrepareSlowElementsForSort(limit); |
@@ -10576,7 +10601,7 @@ |
bool SymbolTable::LookupTwoCharsSymbolIfExists(uint32_t c1, |
uint32_t c2, |
String** symbol) { |
- TwoCharHashTableKey key(c1, c2, GetHeap()->StringHashSeed()); |
+ TwoCharHashTableKey key(c1, c2, GetHeap()->HashSeed()); |
int entry = FindEntry(&key); |
if (entry == kNotFound) { |
return false; |
@@ -10591,14 +10616,14 @@ |
MaybeObject* SymbolTable::LookupSymbol(Vector<const char> str, |
Object** s) { |
- Utf8SymbolKey key(str, GetHeap()->StringHashSeed()); |
+ Utf8SymbolKey key(str, GetHeap()->HashSeed()); |
return LookupKey(&key, s); |
} |
MaybeObject* SymbolTable::LookupAsciiSymbol(Vector<const char> str, |
Object** s) { |
- AsciiSymbolKey key(str, GetHeap()->StringHashSeed()); |
+ AsciiSymbolKey key(str, GetHeap()->HashSeed()); |
return LookupKey(&key, s); |
} |
@@ -10607,14 +10632,14 @@ |
int from, |
int length, |
Object** s) { |
- SubStringAsciiSymbolKey key(str, from, length, GetHeap()->StringHashSeed()); |
+ SubStringAsciiSymbolKey key(str, from, length, GetHeap()->HashSeed()); |
return LookupKey(&key, s); |
} |
MaybeObject* SymbolTable::LookupTwoByteSymbol(Vector<const uc16> str, |
Object** s) { |
- TwoByteSymbolKey key(str, GetHeap()->StringHashSeed()); |
+ TwoByteSymbolKey key(str, GetHeap()->HashSeed()); |
return LookupKey(&key, s); |
} |
@@ -10905,7 +10930,7 @@ |
} |
-void NumberDictionary::RemoveNumberEntries(uint32_t from, uint32_t to) { |
+void SeededNumberDictionary::RemoveNumberEntries(uint32_t from, uint32_t to) { |
// Do nothing if the interval [from, to) is empty. |
if (from >= to) return; |
@@ -10971,8 +10996,9 @@ |
if (!maybe_k->ToObject(&k)) return maybe_k; |
} |
PropertyDetails details = PropertyDetails(NONE, NORMAL); |
- return Dictionary<Shape, Key>::cast(obj)-> |
- AddEntry(key, value, details, Shape::Hash(key)); |
+ |
+ return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details, |
+ Dictionary<Shape, Key>::Hash(key)); |
} |
@@ -10987,8 +11013,9 @@ |
{ MaybeObject* maybe_obj = EnsureCapacity(1, key); |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
} |
- return Dictionary<Shape, Key>::cast(obj)-> |
- AddEntry(key, value, details, Shape::Hash(key)); |
+ |
+ return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details, |
+ Dictionary<Shape, Key>::Hash(key)); |
} |
@@ -11021,7 +11048,7 @@ |
} |
-void NumberDictionary::UpdateMaxNumberKey(uint32_t key) { |
+void SeededNumberDictionary::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; |
@@ -11040,31 +11067,44 @@ |
} |
-MaybeObject* NumberDictionary::AddNumberEntry(uint32_t key, |
- Object* value, |
- PropertyDetails details) { |
+MaybeObject* SeededNumberDictionary::AddNumberEntry(uint32_t key, |
+ Object* value, |
+ PropertyDetails details) { |
UpdateMaxNumberKey(key); |
SLOW_ASSERT(this->FindEntry(key) == kNotFound); |
return Add(key, value, details); |
} |
-MaybeObject* NumberDictionary::AtNumberPut(uint32_t key, Object* value) { |
+MaybeObject* UnseededNumberDictionary::AddNumberEntry(uint32_t key, |
+ Object* value) { |
+ SLOW_ASSERT(this->FindEntry(key) == kNotFound); |
+ return Add(key, value, PropertyDetails(NONE, NORMAL)); |
+} |
+ |
+ |
+MaybeObject* SeededNumberDictionary::AtNumberPut(uint32_t key, Object* value) { |
UpdateMaxNumberKey(key); |
return AtPut(key, value); |
} |
-MaybeObject* NumberDictionary::Set(uint32_t key, |
- Object* value, |
- PropertyDetails details) { |
+MaybeObject* UnseededNumberDictionary::AtNumberPut(uint32_t key, |
+ Object* value) { |
+ return AtPut(key, value); |
+} |
+ |
+ |
+MaybeObject* SeededNumberDictionary::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); |
+ MaybeObject* maybe_object_key = SeededNumberDictionaryShape::AsObject(key); |
Object* object_key; |
if (!maybe_object_key->ToObject(&object_key)) return maybe_object_key; |
SetEntry(entry, object_key, value, details); |
@@ -11072,7 +11112,19 @@ |
} |
+MaybeObject* UnseededNumberDictionary::Set(uint32_t key, |
+ Object* value) { |
+ int entry = FindEntry(key); |
+ if (entry == kNotFound) return AddNumberEntry(key, value); |
+ MaybeObject* maybe_object_key = UnseededNumberDictionaryShape::AsObject(key); |
+ Object* object_key; |
+ if (!maybe_object_key->ToObject(&object_key)) return maybe_object_key; |
+ SetEntry(entry, object_key, value); |
+ return this; |
+} |
+ |
+ |
template<typename Shape, typename Key> |
int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( |
PropertyAttributes filter) { |