@ -1951,9 +1951,10 @@ MaybeObject* JSObject::SetElementWithCallbackSetterInPrototypes(
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 ! = Seeded NumberDictionary: : kNotFound ) {
PropertyDetails details = dictionary - > DetailsAt ( entry ) ;
if ( details . type ( ) = = CALLBACKS ) {
* found = true ;
@ -2928,11 +2929,11 @@ MaybeObject* JSObject::NormalizeElements() {
int old_capacity = 0 ;
int used_elements = 0 ;
GetElementsCapacityAndUsage ( & old_capacity , & used_elements ) ;
NumberDictionary * dictionary = NULL ;
Seeded NumberDictionary* dictionary = NULL ;
{ Object * object ;
MaybeObject * maybe = NumberDictionary : : Allocate ( used_elements ) ;
MaybeObject * maybe = Seeded NumberDictionary: : Allocate ( used_elements ) ;
if ( ! maybe - > ToObject ( & object ) ) return maybe ;
dictionary = NumberDictionary : : cast ( object ) ;
dictionary = Seeded NumberDictionary: : cast ( object ) ;
}
// Copy the elements to the new backing store.
@ -2962,7 +2963,7 @@ MaybeObject* JSObject::NormalizeElements() {
MaybeObject * maybe_result =
dictionary - > AddNumberEntry ( i , value , details ) ;
if ( ! maybe_result - > ToObject ( & result ) ) return maybe_result ;
dictionary = NumberDictionary : : cast ( result ) ;
dictionary = Seeded NumberDictionary: : cast ( result ) ;
}
}
@ -3277,7 +3278,8 @@ bool JSObject::ReferencesObjectFromElements(FixedArray* elements,
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 @@ MaybeObject* JSObject::PreventExtensions() {
}
// If there are fast elements we normalize.
NumberDictionary * dictionary = NULL ;
Seeded NumberDictionary* dictionary = NULL ;
{ MaybeObject * maybe = NormalizeElements ( ) ;
if ( ! maybe - > To < NumberDictionary > ( & dictionary ) ) return maybe ;
if ( ! maybe - > To < Seeded NumberDictionary> ( & dictionary ) ) return maybe ;
}
ASSERT ( HasDictionaryElements ( ) | | HasDictionaryArgumentsElements ( ) ) ;
// Make sure that we never go back to fast case.
@ -3581,11 +3583,11 @@ void JSObject::LookupCallback(String* name, LookupResult* result) {
// 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 ( Seeded NumberDictionary* dictionary ,
uint32_t index ,
Heap * heap ) {
int entry = dictionary - > FindEntry ( index ) ;
if ( entry ! = NumberDictionary : : kNotFound ) {
if ( entry ! = Seeded NumberDictionary: : kNotFound ) {
Object * result = dictionary - > ValueAt ( entry ) ;
PropertyDetails details = dictionary - > DetailsAt ( entry ) ;
if ( details . IsReadOnly ( ) ) return heap - > undefined_value ( ) ;
@ -3647,7 +3649,8 @@ MaybeObject* JSObject::DefineGetterSetter(String* name,
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 @@ MaybeObject* JSObject::SetElementCallback(uint32_t index,
PropertyDetails details = PropertyDetails ( attributes , CALLBACKS ) ;
// Normalize elements to make this operation simple.
NumberDictionary * dictionary = NULL ;
Seeded NumberDictionary* dictionary = NULL ;
{ Object * result ;
MaybeObject * maybe = NormalizeElements ( ) ;
if ( ! maybe - > ToObject ( & result ) ) return maybe ;
dictionary = NumberDictionary : : cast ( result ) ;
dictionary = Seeded NumberDictionary: : cast ( result ) ;
}
ASSERT ( HasDictionaryElements ( ) | | HasDictionaryArgumentsElements ( ) ) ;
@ -3728,7 +3731,7 @@ MaybeObject* JSObject::SetElementCallback(uint32_t index,
{ Object * result ;
MaybeObject * maybe = dictionary - > Set ( index , structure , details ) ;
if ( ! maybe - > ToObject ( & result ) ) return maybe ;
dictionary = NumberDictionary : : cast ( result ) ;
dictionary = Seeded NumberDictionary: : cast ( result ) ;
}
dictionary - > set_requires_slow_elements ( ) ;
@ -3933,9 +3936,9 @@ Object* JSObject::LookupAccessor(String* name, bool is_getter) {
obj = JSObject : : cast ( obj ) - > GetPrototype ( ) ) {
JSObject * js_object = JSObject : : cast ( obj ) ;
if ( js_object - > HasDictionaryElements ( ) ) {
NumberDictionary * dictionary = js_object - > element_dictionary ( ) ;
Seeded NumberDictionary* dictionary = js_object - > element_dictionary ( ) ;
int entry = dictionary - > FindEntry ( index ) ;
if ( entry ! = NumberDictionary : : kNotFound ) {
if ( entry ! = Seeded NumberDictionary: : kNotFound ) {
Object * element = dictionary - > ValueAt ( entry ) ;
PropertyDetails details = dictionary - > DetailsAt ( entry ) ;
if ( details . type ( ) = = CALLBACKS ) {
@ -6077,14 +6080,14 @@ uint32_t String::ComputeAndSetHash() {
if ( StringShape ( this ) . IsSequentialAscii ( ) ) {
field = HashSequentialString ( SeqAsciiString : : cast ( this ) - > GetChars ( ) ,
len ,
GetHeap ( ) - > String HashSeed( ) ) ;
GetHeap ( ) - > HashSeed ( ) ) ;
} else if ( StringShape ( this ) . IsSequentialTwoByte ( ) ) {
field = HashSequentialString ( SeqTwoByteString : : cast ( this ) - > GetChars ( ) ,
len ,
GetHeap ( ) - > String HashSeed( ) ) ;
GetHeap ( ) - > HashSeed ( ) ) ;
} else {
StringInputBuffer buffer ( this ) ;
field = ComputeHashField ( & buffer , len , GetHeap ( ) - > String HashSeed( ) ) ;
field = ComputeHashField ( & buffer , len , GetHeap ( ) - > HashSeed ( ) ) ;
}
// Store the hash code in the object.
@ -7276,7 +7279,7 @@ static void CopyFastElementsToFast(FixedArray* source,
}
static void CopySlowElementsToFast ( NumberDictionary * source ,
static void CopySlowElementsToFast ( Seeded NumberDictionary* source ,
FixedArray * destination ,
WriteBarrierMode mode ) {
for ( int i = 0 ; i < source - > Capacity ( ) ; + + i ) {
@ -7324,7 +7327,7 @@ MaybeObject* JSObject::SetFastElementsCapacityAndLength(int capacity,
case DICTIONARY_ELEMENTS : {
AssertNoAllocation no_gc ;
WriteBarrierMode mode = new_elements - > GetWriteBarrierMode ( no_gc ) ;
CopySlowElementsToFast ( NumberDictionary : : cast ( elements ( ) ) ,
CopySlowElementsToFast ( Seeded NumberDictionary: : cast ( elements ( ) ) ,
new_elements ,
mode ) ;
set_map ( new_map ) ;
@ -7339,7 +7342,7 @@ MaybeObject* JSObject::SetFastElementsCapacityAndLength(int capacity,
FixedArray * parameter_map = FixedArray : : cast ( elements ( ) ) ;
FixedArray * arguments = FixedArray : : cast ( parameter_map - > get ( 1 ) ) ;
if ( arguments - > IsDictionary ( ) ) {
CopySlowElementsToFast ( NumberDictionary : : cast ( arguments ) ,
CopySlowElementsToFast ( Seeded NumberDictionary: : cast ( arguments ) ,
new_elements ,
mode ) ;
} else {
@ -7426,7 +7429,7 @@ MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength(
break ;
}
case DICTIONARY_ELEMENTS : {
elems - > Initialize ( NumberDictionary : : cast ( elements ( ) ) ) ;
elems - > Initialize ( Seeded NumberDictionary: : cast ( elements ( ) ) ) ;
break ;
}
default :
@ -7861,7 +7864,7 @@ bool JSObject::HasElementPostInterceptor(JSReceiver* receiver, uint32_t index) {
}
case DICTIONARY_ELEMENTS : {
if ( element_dictionary ( ) - > FindEntry ( index )
! = NumberDictionary : : kNotFound ) {
! = Seeded NumberDictionary: : kNotFound ) {
return true ;
}
break ;
@ -7993,7 +7996,7 @@ JSObject::LocalElementType JSObject::HasLocalElement(uint32_t index) {
}
case DICTIONARY_ELEMENTS : {
if ( element_dictionary ( ) - > FindEntry ( index ) ! =
NumberDictionary : : kNotFound ) {
Seeded NumberDictionary: : kNotFound ) {
return DICTIONARY_ELEMENT ;
}
break ;
@ -8010,8 +8013,9 @@ JSObject::LocalElementType JSObject::HasLocalElement(uint32_t index) {
// 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 @@ bool JSObject::HasElementInElements(FixedArray* elements,
return true ;
}
} else {
if ( NumberDictionary : : cast ( elements ) - > FindEntry ( index ) ! =
NumberDictionary : : kNotFound ) {
if ( Seeded NumberDictionary: : cast ( elements ) - > FindEntry ( index ) ! =
Seeded NumberDictionary: : kNotFound ) {
return true ;
}
}
@ -8107,7 +8111,7 @@ bool JSObject::HasElementWithReceiver(JSReceiver* receiver, uint32_t index) {
}
case DICTIONARY_ELEMENTS : {
if ( element_dictionary ( ) - > FindEntry ( index )
! = NumberDictionary : : kNotFound ) {
! = Seeded NumberDictionary: : kNotFound ) {
return true ;
}
break ;
@ -8387,15 +8391,15 @@ MaybeObject* JSObject::SetDictionaryElement(uint32_t index,
FixedArray * elements = FixedArray : : cast ( this - > elements ( ) ) ;
bool is_arguments =
( elements - > map ( ) = = heap - > non_strict_arguments_elements_map ( ) ) ;
NumberDictionary * dictionary = NULL ;
Seeded NumberDictionary* dictionary = NULL ;
if ( is_arguments ) {
dictionary = NumberDictionary : : cast ( elements - > get ( 1 ) ) ;
dictionary = Seeded NumberDictionary: : cast ( elements - > get ( 1 ) ) ;
} else {
dictionary = NumberDictionary : : cast ( elements ) ;
dictionary = Seeded NumberDictionary: : cast ( elements ) ;
}
int entry = dictionary - > FindEntry ( index ) ;
if ( entry ! = NumberDictionary : : kNotFound ) {
if ( entry ! = Seeded NumberDictionary: : kNotFound ) {
Object * element = dictionary - > ValueAt ( entry ) ;
PropertyDetails details = dictionary - > DetailsAt ( entry ) ;
if ( details . type ( ) = = CALLBACKS ) {
@ -8440,13 +8444,13 @@ MaybeObject* JSObject::SetDictionaryElement(uint32_t index,
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 ! = Seeded NumberDictionary: : cast ( new_dictionary ) ) {
if ( is_arguments ) {
elements - > set ( 1 , new_dictionary ) ;
} else {
set_elements ( new_dictionary ) ;
}
dictionary = NumberDictionary : : cast ( new_dictionary ) ;
dictionary = Seeded NumberDictionary: : cast ( new_dictionary ) ;
}
}
@ -8767,7 +8771,8 @@ void JSObject::GetElementsCapacityAndUsage(int* capacity, int* used) {
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 @@ void JSObject::GetElementsCapacityAndUsage(int* capacity, int* used) {
}
break ;
case DICTIONARY_ELEMENTS : {
NumberDictionary * dictionary =
NumberDictionary : : cast ( FixedArray : : cast ( elements ( ) ) ) ;
Seeded NumberDictionary* dictionary =
Seeded NumberDictionary: : cast ( FixedArray : : cast ( elements ( ) ) ) ;
* capacity = dictionary - > Capacity ( ) ;
* used = dictionary - > NumberOfElements ( ) ;
break ;
@ -8827,8 +8832,8 @@ bool JSObject::ShouldConvertToSlowElements(int new_capacity) {
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 = Seeded NumberDictionary: : ComputeCapacity ( used_elements ) *
Seeded NumberDictionary: : kEntrySize ;
return 3 * dictionary_size < = new_capacity ;
}
@ -8842,11 +8847,11 @@ bool JSObject::ShouldConvertToFastElements() {
if ( IsAccessCheckNeeded ( ) ) return false ;
FixedArray * elements = FixedArray : : cast ( this - > elements ( ) ) ;
NumberDictionary * dictionary = NULL ;
Seeded NumberDictionary* dictionary = NULL ;
if ( elements - > map ( ) = = GetHeap ( ) - > non_strict_arguments_elements_map ( ) ) {
dictionary = NumberDictionary : : cast ( elements - > get ( 1 ) ) ;
dictionary = Seeded NumberDictionary: : cast ( elements - > get ( 1 ) ) ;
} else {
dictionary = NumberDictionary : : cast ( elements ) ;
dictionary = Seeded NumberDictionary: : 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 @@ bool JSObject::ShouldConvertToFastElements() {
array_size = dictionary - > max_number_key ( ) ;
}
uint32_t dictionary_size = static_cast < uint32_t > ( dictionary - > Capacity ( ) ) *
NumberDictionary : : kEntrySize ;
Seeded NumberDictionary: : kEntrySize ;
return 2 * dictionary_size > = array_size ;
}
@ -8869,7 +8874,8 @@ bool JSObject::ShouldConvertToFastElements() {
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 @@ bool JSObject::HasRealElementProperty(uint32_t index) {
}
case DICTIONARY_ELEMENTS : {
return element_dictionary ( ) - > FindEntry ( index )
! = NumberDictionary : : kNotFound ;
! = Seeded NumberDictionary: : kNotFound ;
}
case NON_STRICT_ARGUMENTS_ELEMENTS :
UNIMPLEMENTED ( ) ;
@ -9350,7 +9356,7 @@ int JSObject::GetLocalElementKeys(FixedArray* storage,
if ( storage ! = NULL ) {
element_dictionary ( ) - > CopyKeysTo ( storage ,
filter ,
NumberDictionary : : SORTED ) ;
Seeded NumberDictionary: : SORTED ) ;
}
counter + = element_dictionary ( ) - > NumberOfElementsFilterAttributes ( filter ) ;
break ;
@ -9362,9 +9368,11 @@ int JSObject::GetLocalElementKeys(FixedArray* storage,
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 @@ class SubStringAsciiSymbolKey : public HashTableKey {
uint32_t Hash ( ) {
ASSERT ( length_ > = 0 ) ;
ASSERT ( from_ + length_ < = string_ - > length ( ) ) ;
StringHasher hasher ( length_ , string_ - > GetHeap ( ) - > String HashSeed( ) ) ;
StringHasher hasher ( length_ , string_ - > GetHeap ( ) - > HashSeed ( ) ) ;
// Very long strings have a trivial hash that doesn't inspect the
// string contents.
@ -9880,7 +9888,7 @@ MaybeObject* HashTable<Shape, Key>::Rehash(HashTable* new_table, Key key) {
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 HashTable<ObjectHashTableShape, JSObject*>;
template class Dictionary < StringDictionaryShape , String * > ;
template class Dictionary < NumberDictionaryShape , uint32_t > ;
template class Dictionary < Seeded NumberDictionaryShape, 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 < Seeded NumberDictionaryShape, 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 < Seeded NumberDictionaryShape, uint32_t > : : CopyKeysTo (
FixedArray * ,
PropertyAttributes ,
Dictionary < NumberDictionaryShape , uint32_t > : : SortMode ) ;
Dictionary < Seeded NumberDictionaryShape, 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 < Seeded NumberDictionaryShape, uint32_t > : :
DeleteProperty ( int , JSObject : : DeleteMode ) ;
template MaybeObject * Dictionary < StringDictionaryShape , String * > : : Shrink (
String * ) ;
template MaybeObject * Dictionary < NumberDictionaryShape , uint32_t > : : Shrink (
template MaybeObject * Dictionary < Seeded NumberDictionaryShape, uint32_t > : : Shrink (
uint32_t ) ;
template void Dictionary < StringDictionaryShape , String * > : : CopyKeysTo (
@ -10026,32 +10042,41 @@ template MaybeObject*
Dictionary < StringDictionaryShape , String * > : : GenerateNewEnumerationIndices ( ) ;
template int
Dictionary < NumberDictionaryShape , uint32_t > : : NumberOfElementsFilterAttributes (
PropertyAttributes ) ;
Dictionary < SeededNumberDictionaryShape , uint32_t > : :
NumberOfElementsFilterAttributes ( PropertyAttributes ) ;
template MaybeObject * Dictionary < SeededNumberDictionaryShape , uint32_t > : : Add (
uint32_t , Object * , PropertyDetails ) ;
template MaybeObject * Dictionary < NumberDictionaryShape , uint32_t > : : Add (
template MaybeObject * Dictionary < Unseeded NumberDictionaryShape, uint32_t > : : Add (
uint32_t , Object * , PropertyDetails ) ;
template MaybeObject * Dictionary < NumberDictionaryShape , uint32_t > : :
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 < Seeded NumberDictionaryShape, uint32_t > : : NumberOfEnumElements ( ) ;
template
int Dictionary < StringDictionaryShape , String * > : : NumberOfEnumElements ( ) ;
template
int HashTable < NumberDictionaryShape , uint32_t > : : FindEntry ( uint32_t ) ;
int HashTable < Seeded NumberDictionaryShape, uint32_t > : : FindEntry ( uint32_t ) ;
// Collates undefined and unexisting elements below limit from position
@ -10061,7 +10086,7 @@ MaybeObject* JSObject::PrepareSlowElementsForSort(uint32_t limit) {
// 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 ( ) ;
Seeded NumberDictionary* 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 @@ MaybeObject* JSObject::PrepareSlowElementsForSort(uint32_t limit) {
Object * obj ;
{ MaybeObject * maybe_obj =
NumberDictionary : : Allocate ( dict - > NumberOfElements ( ) ) ;
Seeded NumberDictionary: : Allocate ( dict - > NumberOfElements ( ) ) ;
if ( ! maybe_obj - > ToObject ( & obj ) ) return maybe_obj ;
}
NumberDictionary * new_dict = NumberDictionary : : cast ( obj ) ;
Seeded NumberDictionary* new_dict = Seeded NumberDictionary: : cast ( obj ) ;
AssertNoAllocation no_alloc ;
@ -10163,7 +10188,7 @@ MaybeObject* JSObject::PrepareElementsForSort(uint32_t limit) {
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 ( ) ;
Seeded NumberDictionary* dict = element_dictionary ( ) ;
if ( IsJSArray ( ) | | dict - > requires_slow_elements ( ) | |
dict - > max_number_key ( ) > = limit ) {
return PrepareSlowElementsForSort ( limit ) ;
@ -10576,7 +10601,7 @@ bool SymbolTable::LookupSymbolIfExists(String* string, String** symbol) {
bool SymbolTable : : LookupTwoCharsSymbolIfExists ( uint32_t c1 ,
uint32_t c2 ,
String * * symbol ) {
TwoCharHashTableKey key ( c1 , c2 , GetHeap ( ) - > String HashSeed( ) ) ;
TwoCharHashTableKey key ( c1 , c2 , GetHeap ( ) - > HashSeed ( ) ) ;
int entry = FindEntry ( & key ) ;
if ( entry = = kNotFound ) {
return false ;
@ -10591,14 +10616,14 @@ bool SymbolTable::LookupTwoCharsSymbolIfExists(uint32_t c1,
MaybeObject * SymbolTable : : LookupSymbol ( Vector < const char > str ,
Object * * s ) {
Utf8SymbolKey key ( str , GetHeap ( ) - > String HashSeed( ) ) ;
Utf8SymbolKey key ( str , GetHeap ( ) - > HashSeed ( ) ) ;
return LookupKey ( & key , s ) ;
}
MaybeObject * SymbolTable : : LookupAsciiSymbol ( Vector < const char > str ,
Object * * s ) {
AsciiSymbolKey key ( str , GetHeap ( ) - > String HashSeed( ) ) ;
AsciiSymbolKey key ( str , GetHeap ( ) - > HashSeed ( ) ) ;
return LookupKey ( & key , s ) ;
}
@ -10607,14 +10632,14 @@ MaybeObject* SymbolTable::LookupSubStringAsciiSymbol(Handle<SeqAsciiString> str,
int from ,
int length ,
Object * * s ) {
SubStringAsciiSymbolKey key ( str , from , length , GetHeap ( ) - > String HashSeed( ) ) ;
SubStringAsciiSymbolKey key ( str , from , length , GetHeap ( ) - > HashSeed ( ) ) ;
return LookupKey ( & key , s ) ;
}
MaybeObject * SymbolTable : : LookupTwoByteSymbol ( Vector < const uc16 > str ,
Object * * s ) {
TwoByteSymbolKey key ( str , GetHeap ( ) - > String HashSeed( ) ) ;
TwoByteSymbolKey key ( str , GetHeap ( ) - > HashSeed ( ) ) ;
return LookupKey ( & key , s ) ;
}
@ -10905,7 +10930,7 @@ MaybeObject* Dictionary<Shape, Key>::EnsureCapacity(int n, Key key) {
}
void NumberDictionary : : RemoveNumberEntries ( uint32_t from , uint32_t to ) {
void Seeded NumberDictionary: : RemoveNumberEntries ( uint32_t from , uint32_t to ) {
// Do nothing if the interval [from, to) is empty.
if ( from > = to ) return ;
@ -10971,8 +10996,9 @@ MaybeObject* Dictionary<Shape, Key>::AtPut(Key key, Object* value) {
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* Dictionary<Shape, Key>::Add(Key key,
{ 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 @@ MaybeObject* Dictionary<Shape, Key>::AddEntry(Key key,
}
void NumberDictionary : : UpdateMaxNumberKey ( uint32_t key ) {
void Seeded NumberDictionary: : 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,7 +11067,7 @@ void NumberDictionary::UpdateMaxNumberKey(uint32_t key) {
}
MaybeObject * NumberDictionary : : AddNumberEntry ( uint32_t key ,
MaybeObject * Seeded NumberDictionary: : AddNumberEntry ( uint32_t key ,
Object * value ,
PropertyDetails details ) {
UpdateMaxNumberKey ( key ) ;
@ -11049,13 +11076,26 @@ MaybeObject* NumberDictionary::AddNumberEntry(uint32_t key,
}
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 ,
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 ) ;
@ -11064,7 +11104,7 @@ MaybeObject* NumberDictionary::Set(uint32_t key,
details = PropertyDetails ( details . attributes ( ) ,
details . type ( ) ,
DetailsAt ( entry ) . index ( ) ) ;
MaybeObject * maybe_object_key = NumberDictionaryShape : : AsObject ( key ) ;
MaybeObject * maybe_object_key = Seeded NumberDictionaryShape: : AsObject ( key ) ;
Object * object_key ;
if ( ! maybe_object_key - > ToObject ( & object_key ) ) return maybe_object_key ;
SetEntry ( entry , object_key , value , details ) ;
@ -11072,6 +11112,18 @@ MaybeObject* NumberDictionary::Set(uint32_t key,
}
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 (