| OLD | NEW | 
|      1 // Copyright 2012 the V8 project authors. All rights reserved. |      1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|      2 // Redistribution and use in source and binary forms, with or without |      2 // Redistribution and use in source and binary forms, with or without | 
|      3 // modification, are permitted provided that the following conditions are |      3 // modification, are permitted provided that the following conditions are | 
|      4 // met: |      4 // met: | 
|      5 // |      5 // | 
|      6 //     * Redistributions of source code must retain the above copyright |      6 //     * Redistributions of source code must retain the above copyright | 
|      7 //       notice, this list of conditions and the following disclaimer. |      7 //       notice, this list of conditions and the following disclaimer. | 
|      8 //     * Redistributions in binary form must reproduce the above |      8 //     * Redistributions in binary form must reproduce the above | 
|      9 //       copyright notice, this list of conditions and the following |      9 //       copyright notice, this list of conditions and the following | 
|     10 //       disclaimer in the documentation and/or other materials provided |     10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 11006 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  11017 template class HashTable<CompilationCacheShape, HashTableKey*>; |  11017 template class HashTable<CompilationCacheShape, HashTableKey*>; | 
|  11018  |  11018  | 
|  11019 template class HashTable<MapCacheShape, HashTableKey*>; |  11019 template class HashTable<MapCacheShape, HashTableKey*>; | 
|  11020  |  11020  | 
|  11021 template class HashTable<ObjectHashTableShape<1>, Object*>; |  11021 template class HashTable<ObjectHashTableShape<1>, Object*>; | 
|  11022  |  11022  | 
|  11023 template class HashTable<ObjectHashTableShape<2>, Object*>; |  11023 template class HashTable<ObjectHashTableShape<2>, Object*>; | 
|  11024  |  11024  | 
|  11025 template class Dictionary<StringDictionaryShape, String*>; |  11025 template class Dictionary<StringDictionaryShape, String*>; | 
|  11026  |  11026  | 
|  11027 template class Dictionary<NumberDictionaryShape, uint32_t>; |  11027 template class Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>; | 
|  11028  |  11028  | 
|  11029 template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Allocate( |  11029 template class Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>; | 
|  11030     int); |  11030  | 
 |  11031 template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
 |  11032     Allocate(int); | 
 |  11033  | 
 |  11034 template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11035     Allocate(int); | 
|  11031  |  11036  | 
|  11032 template MaybeObject* Dictionary<StringDictionaryShape, String*>::Allocate( |  11037 template MaybeObject* Dictionary<StringDictionaryShape, String*>::Allocate( | 
|  11033     int); |  11038     int); | 
|  11034  |  11039  | 
|  11035 template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::AtPut( |  11040 template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
|  11036     uint32_t, Object*); |  11041     AtPut(uint32_t, Object*); | 
|  11037  |  11042  | 
|  11038 template Object* Dictionary<NumberDictionaryShape, uint32_t>::SlowReverseLookup( |  11043 template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
|  11039     Object*); |  11044     AtPut(uint32_t, Object*); | 
 |  11045  | 
 |  11046 template Object* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
 |  11047     SlowReverseLookup(Object*); | 
 |  11048  | 
 |  11049 template Object* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11050     SlowReverseLookup(Object*); | 
|  11040  |  11051  | 
|  11041 template Object* Dictionary<StringDictionaryShape, String*>::SlowReverseLookup( |  11052 template Object* Dictionary<StringDictionaryShape, String*>::SlowReverseLookup( | 
|  11042     Object*); |  11053     Object*); | 
|  11043  |  11054  | 
|  11044 template void Dictionary<NumberDictionaryShape, uint32_t>::CopyKeysTo( |  11055 template void Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
|  11045     FixedArray*, |  11056     CopyKeysTo(FixedArray*, | 
|  11046     PropertyAttributes, |  11057                PropertyAttributes, | 
|  11047     Dictionary<NumberDictionaryShape, uint32_t>::SortMode); |  11058                Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::SortMode); | 
 |  11059  | 
 |  11060 template void Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11061     CopyKeysTo( | 
 |  11062         FixedArray*, | 
 |  11063         PropertyAttributes, | 
 |  11064         Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>::SortMode); | 
|  11048  |  11065  | 
|  11049 template Object* Dictionary<StringDictionaryShape, String*>::DeleteProperty( |  11066 template Object* Dictionary<StringDictionaryShape, String*>::DeleteProperty( | 
|  11050     int, JSObject::DeleteMode); |  11067     int, JSObject::DeleteMode); | 
|  11051  |  11068  | 
|  11052 template Object* Dictionary<NumberDictionaryShape, uint32_t>::DeleteProperty( |  11069 template Object* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
|  11053     int, JSObject::DeleteMode); |  11070     DeleteProperty(int, JSObject::DeleteMode); | 
 |  11071  | 
 |  11072 template Object* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11073     DeleteProperty(int, JSObject::DeleteMode); | 
|  11054  |  11074  | 
|  11055 template MaybeObject* Dictionary<StringDictionaryShape, String*>::Shrink( |  11075 template MaybeObject* Dictionary<StringDictionaryShape, String*>::Shrink( | 
|  11056     String*); |  11076     String*); | 
|  11057  |  11077  | 
|  11058 template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Shrink( |  11078 template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
|  11059     uint32_t); |  11079     Shrink(uint32_t); | 
 |  11080  | 
 |  11081 template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11082     Shrink(uint32_t); | 
|  11060  |  11083  | 
|  11061 template void Dictionary<StringDictionaryShape, String*>::CopyKeysTo( |  11084 template void Dictionary<StringDictionaryShape, String*>::CopyKeysTo( | 
|  11062     FixedArray*, |  11085     FixedArray*, | 
|  11063     int, |  11086     int, | 
|  11064     Dictionary<StringDictionaryShape, String*>::SortMode); |  11087     Dictionary<StringDictionaryShape, String*>::SortMode); | 
|  11065  |  11088  | 
|  11066 template int |  11089 template int | 
|  11067 Dictionary<StringDictionaryShape, String*>::NumberOfElementsFilterAttributes( |  11090 Dictionary<StringDictionaryShape, String*>::NumberOfElementsFilterAttributes( | 
|  11068     PropertyAttributes); |  11091     PropertyAttributes); | 
|  11069  |  11092  | 
|  11070 template MaybeObject* Dictionary<StringDictionaryShape, String*>::Add( |  11093 template MaybeObject* Dictionary<StringDictionaryShape, String*>::Add( | 
|  11071     String*, Object*, PropertyDetails); |  11094     String*, Object*, PropertyDetails); | 
|  11072  |  11095  | 
|  11073 template MaybeObject* |  11096 template MaybeObject* | 
|  11074 Dictionary<StringDictionaryShape, String*>::GenerateNewEnumerationIndices(); |  11097 Dictionary<StringDictionaryShape, String*>::GenerateNewEnumerationIndices(); | 
|  11075  |  11098  | 
|  11076 template int |  11099 template int | 
|  11077 Dictionary<NumberDictionaryShape, uint32_t>::NumberOfElementsFilterAttributes( |  11100 Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
|  11078     PropertyAttributes); |  11101     NumberOfElementsFilterAttributes(PropertyAttributes); | 
|  11079  |  11102  | 
|  11080 template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::Add( |  11103 template int | 
 |  11104 Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11105     NumberOfElementsFilterAttributes(PropertyAttributes); | 
 |  11106  | 
 |  11107 template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>::Add( | 
|  11081     uint32_t, Object*, PropertyDetails); |  11108     uint32_t, Object*, PropertyDetails); | 
|  11082  |  11109  | 
|  11083 template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>:: |  11110 template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11111     Add(uint32_t, Object*, PropertyDetails); | 
 |  11112  | 
 |  11113 template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
 |  11114     EnsureCapacity(int, uint32_t); | 
 |  11115  | 
 |  11116 template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
|  11084     EnsureCapacity(int, uint32_t); |  11117     EnsureCapacity(int, uint32_t); | 
|  11085  |  11118  | 
|  11086 template MaybeObject* Dictionary<StringDictionaryShape, String*>:: |  11119 template MaybeObject* Dictionary<StringDictionaryShape, String*>:: | 
|  11087     EnsureCapacity(int, String*); |  11120     EnsureCapacity(int, String*); | 
|  11088  |  11121  | 
|  11089 template MaybeObject* Dictionary<NumberDictionaryShape, uint32_t>::AddEntry( |  11122 template MaybeObject* Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
|  11090     uint32_t, Object*, PropertyDetails, uint32_t); |  11123     AddEntry(uint32_t, Object*, PropertyDetails, uint32_t); | 
 |  11124  | 
 |  11125 template MaybeObject* Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11126     AddEntry(uint32_t, Object*, PropertyDetails, uint32_t); | 
|  11091  |  11127  | 
|  11092 template MaybeObject* Dictionary<StringDictionaryShape, String*>::AddEntry( |  11128 template MaybeObject* Dictionary<StringDictionaryShape, String*>::AddEntry( | 
|  11093     String*, Object*, PropertyDetails, uint32_t); |  11129     String*, Object*, PropertyDetails, uint32_t); | 
|  11094  |  11130  | 
|  11095 template |  11131 template | 
|  11096 int Dictionary<NumberDictionaryShape, uint32_t>::NumberOfEnumElements(); |  11132 int Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>:: | 
 |  11133     NumberOfEnumElements(); | 
 |  11134  | 
 |  11135 template | 
 |  11136 int Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>:: | 
 |  11137     NumberOfEnumElements(); | 
|  11097  |  11138  | 
|  11098 template |  11139 template | 
|  11099 int Dictionary<StringDictionaryShape, String*>::NumberOfEnumElements(); |  11140 int Dictionary<StringDictionaryShape, String*>::NumberOfEnumElements(); | 
|  11100  |  11141  | 
|  11101 template |  11142 template | 
|  11102 int HashTable<NumberDictionaryShape, uint32_t>::FindEntry(uint32_t); |  11143 int HashTable<NumberDictionaryShape<kSeeded>, uint32_t>::FindEntry(uint32_t); | 
 |  11144  | 
 |  11145 template | 
 |  11146 int HashTable<NumberDictionaryShape<kNotSeeded>, uint32_t>::FindEntry(uint32_t); | 
|  11103  |  11147  | 
|  11104  |  11148  | 
|  11105 // Collates undefined and unexisting elements below limit from position |  11149 // Collates undefined and unexisting elements below limit from position | 
|  11106 // zero of the elements. The object stays in Dictionary mode. |  11150 // zero of the elements. The object stays in Dictionary mode. | 
|  11107 MaybeObject* JSObject::PrepareSlowElementsForSort(uint32_t limit) { |  11151 MaybeObject* JSObject::PrepareSlowElementsForSort(uint32_t limit) { | 
|  11108   ASSERT(HasDictionaryElements()); |  11152   ASSERT(HasDictionaryElements()); | 
|  11109   // Must stay in dictionary mode, either because of requires_slow_elements, |  11153   // Must stay in dictionary mode, either because of requires_slow_elements, | 
|  11110   // or because we are not going to sort (and therefore compact) all of the |  11154   // or because we are not going to sort (and therefore compact) all of the | 
|  11111   // elements. |  11155   // elements. | 
|  11112   NumberDictionary* dict = element_dictionary(); |  11156   NumberDictionary* dict = element_dictionary(); | 
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  12057     SetNextEnumerationIndex(index + 1); |  12101     SetNextEnumerationIndex(index + 1); | 
|  12058   } |  12102   } | 
|  12059   SetEntry(entry, k, value, details); |  12103   SetEntry(entry, k, value, details); | 
|  12060   ASSERT((Dictionary<Shape, Key>::KeyAt(entry)->IsNumber() |  12104   ASSERT((Dictionary<Shape, Key>::KeyAt(entry)->IsNumber() | 
|  12061           || Dictionary<Shape, Key>::KeyAt(entry)->IsString())); |  12105           || Dictionary<Shape, Key>::KeyAt(entry)->IsString())); | 
|  12062   HashTable<Shape, Key>::ElementAdded(); |  12106   HashTable<Shape, Key>::ElementAdded(); | 
|  12063   return this; |  12107   return this; | 
|  12064 } |  12108 } | 
|  12065  |  12109  | 
|  12066  |  12110  | 
|  12067 void NumberDictionary::UpdateMaxNumberKey(uint32_t key) { |  12111 void NumberDictionaryBase::UpdateMaxNumberKey(uint32_t key) { | 
|  12068   // If the dictionary requires slow elements an element has already |  12112   // If the dictionary requires slow elements an element has already | 
|  12069   // been added at a high index. |  12113   // been added at a high index. | 
|  12070   if (requires_slow_elements()) return; |  12114   if (requires_slow_elements()) return; | 
|  12071   // Check if this index is high enough that we should require slow |  12115   // Check if this index is high enough that we should require slow | 
|  12072   // elements. |  12116   // elements. | 
|  12073   if (key > kRequiresSlowElementsLimit) { |  12117   if (key > kRequiresSlowElementsLimit) { | 
|  12074     set_requires_slow_elements(); |  12118     set_requires_slow_elements(); | 
|  12075     return; |  12119     return; | 
|  12076   } |  12120   } | 
|  12077   // Update max key value. |  12121   // Update max key value. | 
|  12078   Object* max_index_object = get(kMaxNumberKeyIndex); |  12122   Object* max_index_object = as_dict()->get( | 
 |  12123       NumberDictionary::kMaxNumberKeyIndex); | 
|  12079   if (!max_index_object->IsSmi() || max_number_key() < key) { |  12124   if (!max_index_object->IsSmi() || max_number_key() < key) { | 
|  12080     FixedArray::set(kMaxNumberKeyIndex, |  12125     as_dict()->set(NumberDictionary::kMaxNumberKeyIndex, | 
|  12081                     Smi::FromInt(key << kRequiresSlowElementsTagSize)); |  12126                    Smi::FromInt(key << kRequiresSlowElementsTagSize)); | 
|  12082   } |  12127   } | 
|  12083 } |  12128 } | 
|  12084  |  12129  | 
|  12085  |  12130  | 
|  12086 MaybeObject* NumberDictionary::AddNumberEntry(uint32_t key, |  12131 MaybeObject* NumberDictionaryBase::AddNumberEntry(uint32_t key, | 
|  12087                                               Object* value, |  12132                                                   Object* value, | 
|  12088                                               PropertyDetails details) { |  12133                                                   PropertyDetails details) { | 
|  12089   UpdateMaxNumberKey(key); |  12134   UpdateMaxNumberKey(key); | 
|  12090   SLOW_ASSERT(this->FindEntry(key) == kNotFound); |  12135   SLOW_ASSERT(as_dict()->FindEntry(key) == NumberDictionary::kNotFound); | 
|  12091   return Add(key, value, details); |  12136   return as_dict()->Add(key, value, details); | 
|  12092 } |  12137 } | 
|  12093  |  12138  | 
|  12094  |  12139  | 
|  12095 MaybeObject* NumberDictionary::AtNumberPut(uint32_t key, Object* value) { |  12140 MaybeObject* NumberDictionaryBase::AtNumberPut(uint32_t key, Object* value) { | 
|  12096   UpdateMaxNumberKey(key); |  12141   UpdateMaxNumberKey(key); | 
|  12097   return AtPut(key, value); |  12142   return as_dict()->AtPut(key, value); | 
|  12098 } |  12143 } | 
|  12099  |  12144  | 
|  12100  |  12145  | 
 |  12146 MaybeObject* NumberDictionaryBase::Set(uint32_t key, | 
 |  12147                                        Object* value, | 
 |  12148                                        PropertyDetails details) { | 
 |  12149   int entry = as_dict()->FindEntry(key); | 
 |  12150   if (entry == NumberDictionary::kNotFound) { | 
 |  12151     return AddNumberEntry(key, value, details); | 
 |  12152   } | 
 |  12153  | 
 |  12154   // Preserve enumeration index. | 
 |  12155   details = PropertyDetails(details.attributes(), | 
 |  12156                             details.type(), | 
 |  12157                             as_dict()->DetailsAt(entry).index()); | 
 |  12158   MaybeObject* maybe_object_key = NumberDictionaryShape<kSeeded>::AsObject(key); | 
 |  12159   Object* object_key; | 
 |  12160   if (!maybe_object_key->ToObject(&object_key)) return maybe_object_key; | 
 |  12161   as_dict()->SetEntry(entry, object_key, value, details); | 
 |  12162   return as_dict(); | 
 |  12163 } | 
 |  12164  | 
 |  12165  | 
|  12101 Handle<NumberDictionary> NumberDictionary::Set( |  12166 Handle<NumberDictionary> NumberDictionary::Set( | 
|  12102     Handle<NumberDictionary> dictionary, |  12167     Handle<NumberDictionary> dictionary, | 
|  12103     uint32_t index, |  12168     uint32_t index, | 
|  12104     Handle<Object> value, |  12169     Handle<Object> value, | 
|  12105     PropertyDetails details) { |  12170     PropertyDetails details) { | 
|  12106   CALL_HEAP_FUNCTION(dictionary->GetIsolate(), |  12171   CALL_HEAP_FUNCTION(dictionary->GetIsolate(), | 
|  12107                      dictionary->Set(index, *value, details), |  12172                      dictionary->Set(index, *value, details), | 
|  12108                      NumberDictionary); |  12173                      NumberDictionary); | 
|  12109 } |  12174 } | 
|  12110  |  12175  | 
|  12111  |  12176  | 
|  12112 MaybeObject* NumberDictionary::Set(uint32_t key, |  12177 Handle<NotSeededNumberDictionary> NotSeededNumberDictionary::Set( | 
|  12113                                    Object* value, |  12178     Handle<NotSeededNumberDictionary> dictionary, | 
|  12114                                    PropertyDetails details) { |  12179     uint32_t index, | 
|  12115   int entry = FindEntry(key); |  12180     Handle<Object> value, | 
|  12116   if (entry == kNotFound) return AddNumberEntry(key, value, details); |  12181     PropertyDetails details) { | 
|  12117   // Preserve enumeration index. |  12182   CALL_HEAP_FUNCTION(dictionary->GetIsolate(), | 
|  12118   details = PropertyDetails(details.attributes(), |  12183                      dictionary->Set(index, *value, details), | 
|  12119                             details.type(), |  12184                      NotSeededNumberDictionary); | 
|  12120                             DetailsAt(entry).index()); |  | 
|  12121   MaybeObject* maybe_object_key = NumberDictionaryShape::AsObject(key); |  | 
|  12122   Object* object_key; |  | 
|  12123   if (!maybe_object_key->ToObject(&object_key)) return maybe_object_key; |  | 
|  12124   SetEntry(entry, object_key, value, details); |  | 
|  12125   return this; |  | 
|  12126 } |  12185 } | 
|  12127  |  12186  | 
|  12128  |  12187  | 
|  12129  |  | 
|  12130 template<typename Shape, typename Key> |  12188 template<typename Shape, typename Key> | 
|  12131 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( |  12189 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( | 
|  12132     PropertyAttributes filter) { |  12190     PropertyAttributes filter) { | 
|  12133   int capacity = HashTable<Shape, Key>::Capacity(); |  12191   int capacity = HashTable<Shape, Key>::Capacity(); | 
|  12134   int result = 0; |  12192   int result = 0; | 
|  12135   for (int i = 0; i < capacity; i++) { |  12193   for (int i = 0; i < capacity; i++) { | 
|  12136     Object* k = HashTable<Shape, Key>::KeyAt(i); |  12194     Object* k = HashTable<Shape, Key>::KeyAt(i); | 
|  12137     if (HashTable<Shape, Key>::IsKey(k)) { |  12195     if (HashTable<Shape, Key>::IsKey(k)) { | 
|  12138       PropertyDetails details = DetailsAt(i); |  12196       PropertyDetails details = DetailsAt(i); | 
|  12139       if (details.IsDeleted()) continue; |  12197       if (details.IsDeleted()) continue; | 
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  12743   if (break_point_objects()->IsUndefined()) return 0; |  12801   if (break_point_objects()->IsUndefined()) return 0; | 
|  12744   // Single break point. |  12802   // Single break point. | 
|  12745   if (!break_point_objects()->IsFixedArray()) return 1; |  12803   if (!break_point_objects()->IsFixedArray()) return 1; | 
|  12746   // Multiple break points. |  12804   // Multiple break points. | 
|  12747   return FixedArray::cast(break_point_objects())->length(); |  12805   return FixedArray::cast(break_point_objects())->length(); | 
|  12748 } |  12806 } | 
|  12749 #endif  // ENABLE_DEBUGGER_SUPPORT |  12807 #endif  // ENABLE_DEBUGGER_SUPPORT | 
|  12750  |  12808  | 
|  12751  |  12809  | 
|  12752 } }  // namespace v8::internal |  12810 } }  // namespace v8::internal | 
| OLD | NEW |