Revert "Reland "HashTable::Shrink() handlified and derived template parameter added to HashTable hierarchy.""
This reverts r20724. TBR=jarin@chromium.org Review URL: https://codereview.chromium.org/237043002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20726 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
92d2c6960b
commit
f4dc0ee882
@ -2882,8 +2882,8 @@ DescriptorArray::WhitenessWitness::~WhitenessWitness() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
int HashTable<Derived, Shape, Key>::ComputeCapacity(int at_least_space_for) {
|
int HashTable<Shape, Key>::ComputeCapacity(int at_least_space_for) {
|
||||||
const int kMinCapacity = 32;
|
const int kMinCapacity = 32;
|
||||||
int capacity = RoundUpToPowerOf2(at_least_space_for * 2);
|
int capacity = RoundUpToPowerOf2(at_least_space_for * 2);
|
||||||
if (capacity < kMinCapacity) {
|
if (capacity < kMinCapacity) {
|
||||||
@ -2893,17 +2893,17 @@ int HashTable<Derived, Shape, Key>::ComputeCapacity(int at_least_space_for) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
|
int HashTable<Shape, Key>::FindEntry(Key key) {
|
||||||
return FindEntry(GetIsolate(), key);
|
return FindEntry(GetIsolate(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find entry for key otherwise return kNotFound.
|
// Find entry for key otherwise return kNotFound.
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) {
|
int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) {
|
||||||
uint32_t capacity = Capacity();
|
uint32_t capacity = Capacity();
|
||||||
uint32_t entry = FirstProbe(HashTable::Hash(key), capacity);
|
uint32_t entry = FirstProbe(HashTable<Shape, Key>::Hash(key), capacity);
|
||||||
uint32_t count = 1;
|
uint32_t count = 1;
|
||||||
// EnsureCapacity will guarantee the hash table is never full.
|
// EnsureCapacity will guarantee the hash table is never full.
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -3028,9 +3028,8 @@ FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) {
|
|||||||
#undef MAKE_STRUCT_CAST
|
#undef MAKE_STRUCT_CAST
|
||||||
|
|
||||||
|
|
||||||
template <typename Derived, typename Shape, typename Key>
|
template <typename Shape, typename Key>
|
||||||
HashTable<Derived, Shape, Key>*
|
HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
|
||||||
HashTable<Derived, Shape, Key>::cast(Object* obj) {
|
|
||||||
ASSERT(obj->IsHashTable());
|
ASSERT(obj->IsHashTable());
|
||||||
return reinterpret_cast<HashTable*>(obj);
|
return reinterpret_cast<HashTable*>(obj);
|
||||||
}
|
}
|
||||||
@ -6672,23 +6671,23 @@ bool AccessorPair::prohibits_overwriting() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void Dictionary<Derived, Shape, Key>::SetEntry(int entry,
|
void Dictionary<Shape, Key>::SetEntry(int entry,
|
||||||
Object* key,
|
Object* key,
|
||||||
Object* value) {
|
Object* value) {
|
||||||
SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0)));
|
SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void Dictionary<Derived, Shape, Key>::SetEntry(int entry,
|
void Dictionary<Shape, Key>::SetEntry(int entry,
|
||||||
Object* key,
|
Object* key,
|
||||||
Object* value,
|
Object* value,
|
||||||
PropertyDetails details) {
|
PropertyDetails details) {
|
||||||
ASSERT(!key->IsName() ||
|
ASSERT(!key->IsName() ||
|
||||||
details.IsDeleted() ||
|
details.IsDeleted() ||
|
||||||
details.dictionary_index() > 0);
|
details.dictionary_index() > 0);
|
||||||
int index = DerivedHashTable::EntryToIndex(entry);
|
int index = HashTable<Shape, Key>::EntryToIndex(entry);
|
||||||
DisallowHeapAllocation no_gc;
|
DisallowHeapAllocation no_gc;
|
||||||
WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc);
|
WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc);
|
||||||
FixedArray::set(index, key, mode);
|
FixedArray::set(index, key, mode);
|
||||||
@ -6774,12 +6773,6 @@ MaybeObject* ObjectHashTableShape::AsObject(Heap* heap, Object* key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Handle<ObjectHashTable> ObjectHashTable::Shrink(
|
|
||||||
Handle<ObjectHashTable> table, Handle<Object> key) {
|
|
||||||
return HashTable_::Shrink(table, *key);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <int entrysize>
|
template <int entrysize>
|
||||||
bool WeakHashTableShape<entrysize>::IsMatch(Object* key, Object* other) {
|
bool WeakHashTableShape<entrysize>::IsMatch(Object* key, Object* other) {
|
||||||
return key->SameValue(other);
|
return key->SameValue(other);
|
||||||
|
477
src/objects.cc
477
src/objects.cc
@ -691,6 +691,13 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO(mstarzinger): Temporary wrapper until target is handlified.
|
||||||
|
Handle<NameDictionary> NameDictionaryShrink(Handle<NameDictionary> dict,
|
||||||
|
Handle<Name> name) {
|
||||||
|
CALL_HEAP_FUNCTION(dict->GetIsolate(), dict->Shrink(*name), NameDictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> JSObject::DeleteNormalizedProperty(Handle<JSObject> object,
|
Handle<Object> JSObject::DeleteNormalizedProperty(Handle<JSObject> object,
|
||||||
Handle<Name> name,
|
Handle<Name> name,
|
||||||
DeleteMode mode) {
|
DeleteMode mode) {
|
||||||
@ -720,7 +727,7 @@ Handle<Object> JSObject::DeleteNormalizedProperty(Handle<JSObject> object,
|
|||||||
Handle<Object> deleted(dictionary->DeleteProperty(entry, mode), isolate);
|
Handle<Object> deleted(dictionary->DeleteProperty(entry, mode), isolate);
|
||||||
if (*deleted == isolate->heap()->true_value()) {
|
if (*deleted == isolate->heap()->true_value()) {
|
||||||
Handle<NameDictionary> new_properties =
|
Handle<NameDictionary> new_properties =
|
||||||
NameDictionary::Shrink(dictionary, *name);
|
NameDictionaryShrink(dictionary, name);
|
||||||
object->set_properties(*new_properties);
|
object->set_properties(*new_properties);
|
||||||
}
|
}
|
||||||
return deleted;
|
return deleted;
|
||||||
@ -13164,12 +13171,12 @@ bool JSObject::ShouldConvertToFastDoubleElements(
|
|||||||
// together, so even though this function belongs in objects-debug.cc,
|
// together, so even though this function belongs in objects-debug.cc,
|
||||||
// we keep it here instead to satisfy certain compilers.
|
// we keep it here instead to satisfy certain compilers.
|
||||||
#ifdef OBJECT_PRINT
|
#ifdef OBJECT_PRINT
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void Dictionary<Derived, Shape, Key>::Print(FILE* out) {
|
void Dictionary<Shape, Key>::Print(FILE* out) {
|
||||||
int capacity = DerivedHashTable::Capacity();
|
int capacity = HashTable<Shape, Key>::Capacity();
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
Object* k = DerivedHashTable::KeyAt(i);
|
Object* k = HashTable<Shape, Key>::KeyAt(i);
|
||||||
if (DerivedHashTable::IsKey(k)) {
|
if (HashTable<Shape, Key>::IsKey(k)) {
|
||||||
PrintF(out, " ");
|
PrintF(out, " ");
|
||||||
if (k->IsString()) {
|
if (k->IsString()) {
|
||||||
String::cast(k)->StringPrint(out);
|
String::cast(k)->StringPrint(out);
|
||||||
@ -13185,15 +13192,15 @@ void Dictionary<Derived, Shape, Key>::Print(FILE* out) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) {
|
void Dictionary<Shape, Key>::CopyValuesTo(FixedArray* elements) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int capacity = DerivedHashTable::Capacity();
|
int capacity = HashTable<Shape, Key>::Capacity();
|
||||||
DisallowHeapAllocation no_gc;
|
DisallowHeapAllocation no_gc;
|
||||||
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
|
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
Object* k = Dictionary::KeyAt(i);
|
Object* k = Dictionary<Shape, Key>::KeyAt(i);
|
||||||
if (Dictionary::IsKey(k)) {
|
if (Dictionary<Shape, Key>::IsKey(k)) {
|
||||||
elements->set(pos++, ValueAt(i), mode);
|
elements->set(pos++, ValueAt(i), mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13897,26 +13904,25 @@ class InternalizedStringKey : public HashTableKey {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void HashTable<Derived, Shape, Key>::IteratePrefix(ObjectVisitor* v) {
|
void HashTable<Shape, Key>::IteratePrefix(ObjectVisitor* v) {
|
||||||
IteratePointers(v, 0, kElementsStartOffset);
|
IteratePointers(v, 0, kElementsStartOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void HashTable<Derived, Shape, Key>::IterateElements(ObjectVisitor* v) {
|
void HashTable<Shape, Key>::IterateElements(ObjectVisitor* v) {
|
||||||
IteratePointers(v,
|
IteratePointers(v,
|
||||||
kElementsStartOffset,
|
kElementsStartOffset,
|
||||||
kHeaderSize + length() * kPointerSize);
|
kHeaderSize + length() * kPointerSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
MaybeObject* HashTable<Derived, Shape, Key>::Allocate(
|
MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap,
|
||||||
Heap* heap,
|
int at_least_space_for,
|
||||||
int at_least_space_for,
|
MinimumCapacity capacity_option,
|
||||||
MinimumCapacity capacity_option,
|
PretenureFlag pretenure) {
|
||||||
PretenureFlag pretenure) {
|
|
||||||
ASSERT(!capacity_option || IsPowerOf2(at_least_space_for));
|
ASSERT(!capacity_option || IsPowerOf2(at_least_space_for));
|
||||||
int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
|
int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
|
||||||
? at_least_space_for
|
? at_least_space_for
|
||||||
@ -13937,23 +13943,10 @@ MaybeObject* HashTable<Derived, Shape, Key>::Allocate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
|
||||||
Handle<Derived> HashTable<Derived, Shape, Key>::New(
|
|
||||||
Isolate* isolate,
|
|
||||||
int at_least_space_for,
|
|
||||||
MinimumCapacity capacity_option,
|
|
||||||
PretenureFlag pretenure) {
|
|
||||||
CALL_HEAP_FUNCTION(
|
|
||||||
isolate,
|
|
||||||
Allocate(isolate->heap(), at_least_space_for, capacity_option, pretenure),
|
|
||||||
Derived);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Find entry for key otherwise return kNotFound.
|
// Find entry for key otherwise return kNotFound.
|
||||||
int NameDictionary::FindEntry(Name* key) {
|
int NameDictionary::FindEntry(Name* key) {
|
||||||
if (!key->IsUniqueName()) {
|
if (!key->IsUniqueName()) {
|
||||||
return DerivedHashTable::FindEntry(key);
|
return HashTable<NameDictionaryShape, Name*>::FindEntry(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optimized for unique names. Knowledge of the key type allows:
|
// Optimized for unique names. Knowledge of the key type allows:
|
||||||
@ -13990,8 +13983,8 @@ int NameDictionary::FindEntry(Name* key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void HashTable<Derived, Shape, Key>::Rehash(Derived* new_table, Key key) {
|
MaybeObject* HashTable<Shape, Key>::Rehash(HashTable* new_table, Key key) {
|
||||||
ASSERT(NumberOfElements() < new_table->Capacity());
|
ASSERT(NumberOfElements() < new_table->Capacity());
|
||||||
|
|
||||||
DisallowHeapAllocation no_gc;
|
DisallowHeapAllocation no_gc;
|
||||||
@ -14010,7 +14003,7 @@ void HashTable<Derived, Shape, Key>::Rehash(Derived* new_table, Key key) {
|
|||||||
uint32_t from_index = EntryToIndex(i);
|
uint32_t from_index = EntryToIndex(i);
|
||||||
Object* k = get(from_index);
|
Object* k = get(from_index);
|
||||||
if (IsKey(k)) {
|
if (IsKey(k)) {
|
||||||
uint32_t hash = HashTable::HashForObject(key, k);
|
uint32_t hash = HashTable<Shape, Key>::HashForObject(key, k);
|
||||||
uint32_t insertion_index =
|
uint32_t insertion_index =
|
||||||
EntryToIndex(new_table->FindInsertionEntry(hash));
|
EntryToIndex(new_table->FindInsertionEntry(hash));
|
||||||
for (int j = 0; j < Shape::kEntrySize; j++) {
|
for (int j = 0; j < Shape::kEntrySize; j++) {
|
||||||
@ -14020,16 +14013,16 @@ void HashTable<Derived, Shape, Key>::Rehash(Derived* new_table, Key key) {
|
|||||||
}
|
}
|
||||||
new_table->SetNumberOfElements(NumberOfElements());
|
new_table->SetNumberOfElements(NumberOfElements());
|
||||||
new_table->SetNumberOfDeletedElements(0);
|
new_table->SetNumberOfDeletedElements(0);
|
||||||
|
return new_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
uint32_t HashTable<Derived, Shape, Key>::EntryForProbe(
|
uint32_t HashTable<Shape, Key>::EntryForProbe(Key key,
|
||||||
Key key,
|
Object* k,
|
||||||
Object* k,
|
int probe,
|
||||||
int probe,
|
uint32_t expected) {
|
||||||
uint32_t expected) {
|
uint32_t hash = HashTable<Shape, Key>::HashForObject(key, k);
|
||||||
uint32_t hash = HashTable::HashForObject(key, k);
|
|
||||||
uint32_t capacity = Capacity();
|
uint32_t capacity = Capacity();
|
||||||
uint32_t entry = FirstProbe(hash, capacity);
|
uint32_t entry = FirstProbe(hash, capacity);
|
||||||
for (int i = 1; i < probe; i++) {
|
for (int i = 1; i < probe; i++) {
|
||||||
@ -14040,10 +14033,10 @@ uint32_t HashTable<Derived, Shape, Key>::EntryForProbe(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void HashTable<Derived, Shape, Key>::Swap(uint32_t entry1,
|
void HashTable<Shape, Key>::Swap(uint32_t entry1,
|
||||||
uint32_t entry2,
|
uint32_t entry2,
|
||||||
WriteBarrierMode mode) {
|
WriteBarrierMode mode) {
|
||||||
int index1 = EntryToIndex(entry1);
|
int index1 = EntryToIndex(entry1);
|
||||||
int index2 = EntryToIndex(entry2);
|
int index2 = EntryToIndex(entry2);
|
||||||
Object* temp[Shape::kEntrySize];
|
Object* temp[Shape::kEntrySize];
|
||||||
@ -14059,8 +14052,8 @@ void HashTable<Derived, Shape, Key>::Swap(uint32_t entry1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void HashTable<Derived, Shape, Key>::Rehash(Key key) {
|
void HashTable<Shape, Key>::Rehash(Key key) {
|
||||||
DisallowHeapAllocation no_gc;
|
DisallowHeapAllocation no_gc;
|
||||||
WriteBarrierMode mode = GetWriteBarrierMode(no_gc);
|
WriteBarrierMode mode = GetWriteBarrierMode(no_gc);
|
||||||
uint32_t capacity = Capacity();
|
uint32_t capacity = Capacity();
|
||||||
@ -14092,11 +14085,10 @@ void HashTable<Derived, Shape, Key>::Rehash(Key key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
MaybeObject* HashTable<Derived, Shape, Key>::EnsureCapacity(
|
MaybeObject* HashTable<Shape, Key>::EnsureCapacity(int n,
|
||||||
int n,
|
Key key,
|
||||||
Key key,
|
PretenureFlag pretenure) {
|
||||||
PretenureFlag pretenure) {
|
|
||||||
int capacity = Capacity();
|
int capacity = Capacity();
|
||||||
int nof = NumberOfElements() + n;
|
int nof = NumberOfElements() + n;
|
||||||
int nod = NumberOfDeletedElements();
|
int nod = NumberOfDeletedElements();
|
||||||
@ -14120,45 +14112,44 @@ MaybeObject* HashTable<Derived, Shape, Key>::EnsureCapacity(
|
|||||||
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rehash(Derived::cast(obj), key);
|
return Rehash(HashTable::cast(obj), key);
|
||||||
return Derived::cast(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
Handle<Derived> HashTable<Derived, Shape, Key>::Shrink(Handle<Derived> table,
|
MaybeObject* HashTable<Shape, Key>::Shrink(Key key) {
|
||||||
Key key) {
|
int capacity = Capacity();
|
||||||
int capacity = table->Capacity();
|
int nof = NumberOfElements();
|
||||||
int nof = table->NumberOfElements();
|
|
||||||
|
|
||||||
// Shrink to fit the number of elements if only a quarter of the
|
// Shrink to fit the number of elements if only a quarter of the
|
||||||
// capacity is filled with elements.
|
// capacity is filled with elements.
|
||||||
if (nof > (capacity >> 2)) return table;
|
if (nof > (capacity >> 2)) return this;
|
||||||
// Allocate a new dictionary with room for at least the current
|
// Allocate a new dictionary with room for at least the current
|
||||||
// number of elements. The allocation method will make sure that
|
// number of elements. The allocation method will make sure that
|
||||||
// there is extra room in the dictionary for additions. Don't go
|
// there is extra room in the dictionary for additions. Don't go
|
||||||
// lower than room for 16 elements.
|
// lower than room for 16 elements.
|
||||||
int at_least_room_for = nof;
|
int at_least_room_for = nof;
|
||||||
if (at_least_room_for < 16) return table;
|
if (at_least_room_for < 16) return this;
|
||||||
|
|
||||||
Isolate* isolate = table->GetIsolate();
|
|
||||||
const int kMinCapacityForPretenure = 256;
|
const int kMinCapacityForPretenure = 256;
|
||||||
bool pretenure =
|
bool pretenure =
|
||||||
(at_least_room_for > kMinCapacityForPretenure) &&
|
(at_least_room_for > kMinCapacityForPretenure) &&
|
||||||
!isolate->heap()->InNewSpace(*table);
|
!GetHeap()->InNewSpace(this);
|
||||||
Handle<Derived> new_table = New(
|
Object* obj;
|
||||||
isolate,
|
{ MaybeObject* maybe_obj =
|
||||||
at_least_room_for,
|
Allocate(GetHeap(),
|
||||||
USE_DEFAULT_MINIMUM_CAPACITY,
|
at_least_room_for,
|
||||||
pretenure ? TENURED : NOT_TENURED);
|
USE_DEFAULT_MINIMUM_CAPACITY,
|
||||||
|
pretenure ? TENURED : NOT_TENURED);
|
||||||
|
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
||||||
|
}
|
||||||
|
|
||||||
table->Rehash(*new_table, key);
|
return Rehash(HashTable::cast(obj), key);
|
||||||
return new_table;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
uint32_t HashTable<Derived, Shape, Key>::FindInsertionEntry(uint32_t hash) {
|
uint32_t HashTable<Shape, Key>::FindInsertionEntry(uint32_t hash) {
|
||||||
uint32_t capacity = Capacity();
|
uint32_t capacity = Capacity();
|
||||||
uint32_t entry = FirstProbe(hash, capacity);
|
uint32_t entry = FirstProbe(hash, capacity);
|
||||||
uint32_t count = 1;
|
uint32_t count = 1;
|
||||||
@ -14175,165 +14166,129 @@ uint32_t HashTable<Derived, Shape, Key>::FindInsertionEntry(uint32_t hash) {
|
|||||||
// Force instantiation of template instances class.
|
// Force instantiation of template instances class.
|
||||||
// Please note this list is compiler dependent.
|
// Please note this list is compiler dependent.
|
||||||
|
|
||||||
template class HashTable<StringTable, StringTableShape, HashTableKey*>;
|
template class HashTable<StringTableShape, HashTableKey*>;
|
||||||
|
|
||||||
template class HashTable<CompilationCacheTable,
|
template class HashTable<CompilationCacheShape, HashTableKey*>;
|
||||||
CompilationCacheShape,
|
|
||||||
HashTableKey*>;
|
|
||||||
|
|
||||||
template class HashTable<MapCache, MapCacheShape, HashTableKey*>;
|
template class HashTable<MapCacheShape, HashTableKey*>;
|
||||||
|
|
||||||
template class HashTable<ObjectHashTable, ObjectHashTableShape, Object*>;
|
template class HashTable<ObjectHashTableShape, Object*>;
|
||||||
|
|
||||||
template class HashTable<WeakHashTable, WeakHashTableShape<2>, Object*>;
|
template class HashTable<WeakHashTableShape<2>, Object*>;
|
||||||
|
|
||||||
template class Dictionary<NameDictionary, NameDictionaryShape, Name*>;
|
template class Dictionary<NameDictionaryShape, Name*>;
|
||||||
|
|
||||||
template class Dictionary<SeededNumberDictionary,
|
template class Dictionary<SeededNumberDictionaryShape, uint32_t>;
|
||||||
SeededNumberDictionaryShape,
|
|
||||||
uint32_t>;
|
|
||||||
|
|
||||||
template class Dictionary<UnseededNumberDictionary,
|
template class Dictionary<UnseededNumberDictionaryShape, uint32_t>;
|
||||||
UnseededNumberDictionaryShape,
|
|
||||||
uint32_t>;
|
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
|
||||||
Allocate(Heap* heap, int at_least_space_for, PretenureFlag pretenure);
|
Allocate(Heap* heap, int at_least_space_for, PretenureFlag pretenure);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
|
|
||||||
Allocate(Heap* heap, int at_least_space_for, PretenureFlag pretenure);
|
Allocate(Heap* heap, int at_least_space_for, PretenureFlag pretenure);
|
||||||
|
|
||||||
template MaybeObject* Dictionary<NameDictionary, NameDictionaryShape, Name*>::
|
template MaybeObject* Dictionary<NameDictionaryShape, Name*>::
|
||||||
Allocate(Heap* heap, int n, PretenureFlag pretenure);
|
Allocate(Heap* heap, int n, PretenureFlag pretenure);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::AtPut(
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
uint32_t, Object*);
|
||||||
|
|
||||||
|
template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
|
||||||
AtPut(uint32_t, Object*);
|
AtPut(uint32_t, Object*);
|
||||||
|
|
||||||
template MaybeObject*
|
template Object* Dictionary<SeededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
|
|
||||||
AtPut(uint32_t, Object*);
|
|
||||||
|
|
||||||
template Object*
|
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
|
||||||
SlowReverseLookup(Object* value);
|
SlowReverseLookup(Object* value);
|
||||||
|
|
||||||
template Object*
|
template Object* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
|
|
||||||
SlowReverseLookup(Object* value);
|
SlowReverseLookup(Object* value);
|
||||||
|
|
||||||
template Object*
|
template Object* Dictionary<NameDictionaryShape, Name*>::SlowReverseLookup(
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::SlowReverseLookup(
|
|
||||||
Object*);
|
Object*);
|
||||||
|
|
||||||
template void
|
template void Dictionary<SeededNumberDictionaryShape, uint32_t>::CopyKeysTo(
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
FixedArray*,
|
||||||
CopyKeysTo(
|
PropertyAttributes,
|
||||||
FixedArray*,
|
Dictionary<SeededNumberDictionaryShape, uint32_t>::SortMode);
|
||||||
PropertyAttributes,
|
|
||||||
Dictionary<SeededNumberDictionary,
|
|
||||||
SeededNumberDictionaryShape,
|
|
||||||
uint32_t>::SortMode);
|
|
||||||
|
|
||||||
template Object*
|
template Object* Dictionary<NameDictionaryShape, Name*>::DeleteProperty(
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
|
|
||||||
int, JSObject::DeleteMode);
|
int, JSObject::DeleteMode);
|
||||||
|
|
||||||
template Handle<Object>
|
template Handle<Object> Dictionary<NameDictionaryShape, Name*>::DeleteProperty(
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
|
Handle<Dictionary<NameDictionaryShape, Name*> >,
|
||||||
Handle<Dictionary<NameDictionary, NameDictionaryShape, Name*> >,
|
|
||||||
int,
|
int,
|
||||||
JSObject::DeleteMode);
|
JSObject::DeleteMode);
|
||||||
|
|
||||||
template Object*
|
template Object* Dictionary<SeededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
|
||||||
DeleteProperty(int, JSObject::DeleteMode);
|
DeleteProperty(int, JSObject::DeleteMode);
|
||||||
|
|
||||||
template Handle<Object>
|
template Handle<Object>
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
Dictionary<SeededNumberDictionaryShape, uint32_t>::DeleteProperty(
|
||||||
DeleteProperty(
|
Handle<Dictionary<SeededNumberDictionaryShape, uint32_t> >,
|
||||||
Handle<Dictionary<SeededNumberDictionary,
|
int,
|
||||||
SeededNumberDictionaryShape,
|
JSObject::DeleteMode);
|
||||||
uint32_t> >,
|
|
||||||
int,
|
|
||||||
JSObject::DeleteMode);
|
|
||||||
|
|
||||||
template Handle<NameDictionary>
|
template MaybeObject* Dictionary<NameDictionaryShape, Name*>::Shrink(Name* n);
|
||||||
HashTable<NameDictionary, NameDictionaryShape, Name*>::
|
|
||||||
Shrink(Handle<NameDictionary>, Name* n);
|
|
||||||
|
|
||||||
template Handle<SeededNumberDictionary>
|
template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::Shrink(
|
||||||
HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
uint32_t);
|
||||||
Shrink(Handle<SeededNumberDictionary>, uint32_t);
|
template Handle<FixedArray>
|
||||||
|
Dictionary<SeededNumberDictionaryShape, uint32_t>::Shrink(
|
||||||
|
Handle<Dictionary<SeededNumberDictionaryShape, uint32_t> >,
|
||||||
|
uint32_t);
|
||||||
|
|
||||||
template void Dictionary<NameDictionary, NameDictionaryShape, Name*>::
|
template void Dictionary<NameDictionaryShape, Name*>::CopyKeysTo(
|
||||||
CopyKeysTo(
|
FixedArray*,
|
||||||
FixedArray*,
|
int,
|
||||||
int,
|
PropertyAttributes,
|
||||||
PropertyAttributes,
|
Dictionary<NameDictionaryShape, Name*>::SortMode);
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::SortMode);
|
|
||||||
|
|
||||||
template int
|
template int
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::
|
Dictionary<NameDictionaryShape, Name*>::NumberOfElementsFilterAttributes(
|
||||||
NumberOfElementsFilterAttributes(PropertyAttributes);
|
PropertyAttributes);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<NameDictionaryShape, Name*>::Add(
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::Add(
|
|
||||||
Name*, Object*, PropertyDetails);
|
Name*, Object*, PropertyDetails);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject*
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::
|
Dictionary<NameDictionaryShape, Name*>::GenerateNewEnumerationIndices();
|
||||||
GenerateNewEnumerationIndices();
|
|
||||||
|
|
||||||
template int
|
template int
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
Dictionary<SeededNumberDictionaryShape, uint32_t>::
|
||||||
NumberOfElementsFilterAttributes(PropertyAttributes);
|
NumberOfElementsFilterAttributes(PropertyAttributes);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::Add(
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::Add(
|
|
||||||
uint32_t, Object*, PropertyDetails);
|
uint32_t, Object*, PropertyDetails);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::Add(
|
||||||
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
|
uint32_t, Object*, PropertyDetails);
|
||||||
Add(uint32_t, Object*, PropertyDetails);
|
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
|
||||||
EnsureCapacity(int, uint32_t);
|
EnsureCapacity(int, uint32_t);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
|
|
||||||
EnsureCapacity(int, uint32_t);
|
EnsureCapacity(int, uint32_t);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<NameDictionaryShape, Name*>::
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::
|
|
||||||
EnsureCapacity(int, Name*);
|
EnsureCapacity(int, Name*);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
|
||||||
AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
|
AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
|
||||||
Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
|
|
||||||
AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
|
AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
|
||||||
|
|
||||||
template MaybeObject*
|
template MaybeObject* Dictionary<NameDictionaryShape, Name*>::AddEntry(
|
||||||
Dictionary<NameDictionary, NameDictionaryShape, Name*>::AddEntry(
|
|
||||||
Name*, Object*, PropertyDetails, uint32_t);
|
Name*, Object*, PropertyDetails, uint32_t);
|
||||||
|
|
||||||
template
|
template
|
||||||
int Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
int Dictionary<SeededNumberDictionaryShape, uint32_t>::NumberOfEnumElements();
|
||||||
NumberOfEnumElements();
|
|
||||||
|
|
||||||
template
|
template
|
||||||
int Dictionary<NameDictionary, NameDictionaryShape, Name*>::
|
int Dictionary<NameDictionaryShape, Name*>::NumberOfEnumElements();
|
||||||
NumberOfEnumElements();
|
|
||||||
|
|
||||||
template
|
template
|
||||||
int HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
|
int HashTable<SeededNumberDictionaryShape, uint32_t>::FindEntry(uint32_t);
|
||||||
FindEntry(uint32_t);
|
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> JSObject::PrepareSlowElementsForSort(
|
Handle<Object> JSObject::PrepareSlowElementsForSort(
|
||||||
@ -15179,14 +15134,13 @@ MaybeObject* MapCache::Put(FixedArray* array, Map* value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
MaybeObject* Dictionary<Derived, Shape, Key>::Allocate(
|
MaybeObject* Dictionary<Shape, Key>::Allocate(Heap* heap,
|
||||||
Heap* heap,
|
int at_least_space_for,
|
||||||
int at_least_space_for,
|
PretenureFlag pretenure) {
|
||||||
PretenureFlag pretenure) {
|
|
||||||
Object* obj;
|
Object* obj;
|
||||||
{ MaybeObject* maybe_obj =
|
{ MaybeObject* maybe_obj =
|
||||||
DerivedHashTable::Allocate(
|
HashTable<Shape, Key>::Allocate(
|
||||||
heap,
|
heap,
|
||||||
at_least_space_for,
|
at_least_space_for,
|
||||||
USE_DEFAULT_MINIMUM_CAPACITY,
|
USE_DEFAULT_MINIMUM_CAPACITY,
|
||||||
@ -15194,7 +15148,7 @@ MaybeObject* Dictionary<Derived, Shape, Key>::Allocate(
|
|||||||
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
||||||
}
|
}
|
||||||
// Initialize the next enumeration index.
|
// Initialize the next enumeration index.
|
||||||
Dictionary::cast(obj)->
|
Dictionary<Shape, Key>::cast(obj)->
|
||||||
SetNextEnumerationIndex(PropertyDetails::kInitialIndex);
|
SetNextEnumerationIndex(PropertyDetails::kInitialIndex);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -15206,10 +15160,10 @@ void NameDictionary::DoGenerateNewEnumerationIndices(
|
|||||||
dictionary->GenerateNewEnumerationIndices());
|
dictionary->GenerateNewEnumerationIndices());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
MaybeObject* Dictionary<Derived, Shape, Key>::GenerateNewEnumerationIndices() {
|
MaybeObject* Dictionary<Shape, Key>::GenerateNewEnumerationIndices() {
|
||||||
Heap* heap = Dictionary::GetHeap();
|
Heap* heap = Dictionary<Shape, Key>::GetHeap();
|
||||||
int length = DerivedHashTable::NumberOfElements();
|
int length = HashTable<Shape, Key>::NumberOfElements();
|
||||||
|
|
||||||
// Allocate and initialize iteration order array.
|
// Allocate and initialize iteration order array.
|
||||||
Object* obj;
|
Object* obj;
|
||||||
@ -15228,10 +15182,10 @@ MaybeObject* Dictionary<Derived, Shape, Key>::GenerateNewEnumerationIndices() {
|
|||||||
FixedArray* enumeration_order = FixedArray::cast(obj);
|
FixedArray* enumeration_order = FixedArray::cast(obj);
|
||||||
|
|
||||||
// Fill the enumeration order array with property details.
|
// Fill the enumeration order array with property details.
|
||||||
int capacity = DerivedHashTable::Capacity();
|
int capacity = HashTable<Shape, Key>::Capacity();
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
if (Dictionary::IsKey(Dictionary::KeyAt(i))) {
|
if (Dictionary<Shape, Key>::IsKey(Dictionary<Shape, Key>::KeyAt(i))) {
|
||||||
int index = DetailsAt(i).dictionary_index();
|
int index = DetailsAt(i).dictionary_index();
|
||||||
enumeration_order->set(pos++, Smi::FromInt(index));
|
enumeration_order->set(pos++, Smi::FromInt(index));
|
||||||
}
|
}
|
||||||
@ -15248,10 +15202,10 @@ MaybeObject* Dictionary<Derived, Shape, Key>::GenerateNewEnumerationIndices() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the dictionary with new indices.
|
// Update the dictionary with new indices.
|
||||||
capacity = DerivedHashTable::Capacity();
|
capacity = HashTable<Shape, Key>::Capacity();
|
||||||
pos = 0;
|
pos = 0;
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
if (Dictionary::IsKey(Dictionary::KeyAt(i))) {
|
if (Dictionary<Shape, Key>::IsKey(Dictionary<Shape, Key>::KeyAt(i))) {
|
||||||
int enum_index = Smi::cast(enumeration_order->get(pos++))->value();
|
int enum_index = Smi::cast(enumeration_order->get(pos++))->value();
|
||||||
PropertyDetails details = DetailsAt(i);
|
PropertyDetails details = DetailsAt(i);
|
||||||
PropertyDetails new_details = PropertyDetails(
|
PropertyDetails new_details = PropertyDetails(
|
||||||
@ -15265,8 +15219,8 @@ MaybeObject* Dictionary<Derived, Shape, Key>::GenerateNewEnumerationIndices() {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
MaybeObject* Dictionary<Derived, Shape, Key>::EnsureCapacity(int n, Key key) {
|
MaybeObject* Dictionary<Shape, Key>::EnsureCapacity(int n, Key key) {
|
||||||
// Check whether there are enough enumeration indices to add n elements.
|
// Check whether there are enough enumeration indices to add n elements.
|
||||||
if (Shape::kIsEnumerable &&
|
if (Shape::kIsEnumerable &&
|
||||||
!PropertyDetails::IsValidIndex(NextEnumerationIndex() + n)) {
|
!PropertyDetails::IsValidIndex(NextEnumerationIndex() + n)) {
|
||||||
@ -15276,14 +15230,14 @@ MaybeObject* Dictionary<Derived, Shape, Key>::EnsureCapacity(int n, Key key) {
|
|||||||
if (!maybe_result->ToObject(&result)) return maybe_result;
|
if (!maybe_result->ToObject(&result)) return maybe_result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DerivedHashTable::EnsureCapacity(n, key);
|
return HashTable<Shape, Key>::EnsureCapacity(n, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO(ishell): Temporary wrapper until handlified.
|
// TODO(ishell): Temporary wrapper until handlified.
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
|
Handle<Object> Dictionary<Shape, Key>::DeleteProperty(
|
||||||
Handle<Dictionary<Derived, Shape, Key> > dictionary,
|
Handle<Dictionary<Shape, Key> > dictionary,
|
||||||
int entry,
|
int entry,
|
||||||
JSObject::DeleteMode mode) {
|
JSObject::DeleteMode mode) {
|
||||||
CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
|
CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
|
||||||
@ -15292,28 +15246,44 @@ Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
Object* Dictionary<Derived, Shape, Key>::DeleteProperty(
|
Object* Dictionary<Shape, Key>::DeleteProperty(int entry,
|
||||||
int entry,
|
JSReceiver::DeleteMode mode) {
|
||||||
JSReceiver::DeleteMode mode) {
|
Heap* heap = Dictionary<Shape, Key>::GetHeap();
|
||||||
Heap* heap = Dictionary::GetHeap();
|
|
||||||
PropertyDetails details = DetailsAt(entry);
|
PropertyDetails details = DetailsAt(entry);
|
||||||
// Ignore attributes if forcing a deletion.
|
// Ignore attributes if forcing a deletion.
|
||||||
if (details.IsDontDelete() && mode != JSReceiver::FORCE_DELETION) {
|
if (details.IsDontDelete() && mode != JSReceiver::FORCE_DELETION) {
|
||||||
return heap->false_value();
|
return heap->false_value();
|
||||||
}
|
}
|
||||||
SetEntry(entry, heap->the_hole_value(), heap->the_hole_value());
|
SetEntry(entry, heap->the_hole_value(), heap->the_hole_value());
|
||||||
DerivedHashTable::ElementRemoved();
|
HashTable<Shape, Key>::ElementRemoved();
|
||||||
return heap->true_value();
|
return heap->true_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
// TODO(ishell): Temporary wrapper until handlified.
|
||||||
MaybeObject* Dictionary<Derived, Shape, Key>::AtPut(Key key, Object* value) {
|
template<typename Shape, typename Key>
|
||||||
|
Handle<FixedArray> Dictionary<Shape, Key>::Shrink(
|
||||||
|
Handle<Dictionary<Shape, Key> > dictionary,
|
||||||
|
Key key) {
|
||||||
|
CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
|
||||||
|
dictionary->Shrink(key),
|
||||||
|
FixedArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename Shape, typename Key>
|
||||||
|
MaybeObject* Dictionary<Shape, Key>::Shrink(Key key) {
|
||||||
|
return HashTable<Shape, Key>::Shrink(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename Shape, typename Key>
|
||||||
|
MaybeObject* Dictionary<Shape, Key>::AtPut(Key key, Object* value) {
|
||||||
int entry = this->FindEntry(key);
|
int entry = this->FindEntry(key);
|
||||||
|
|
||||||
// If the entry is present set the value;
|
// If the entry is present set the value;
|
||||||
if (entry != Dictionary::kNotFound) {
|
if (entry != Dictionary<Shape, Key>::kNotFound) {
|
||||||
ValueAtPut(entry, value);
|
ValueAtPut(entry, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -15330,43 +15300,41 @@ MaybeObject* Dictionary<Derived, Shape, Key>::AtPut(Key key, Object* value) {
|
|||||||
}
|
}
|
||||||
PropertyDetails details = PropertyDetails(NONE, NORMAL, 0);
|
PropertyDetails details = PropertyDetails(NONE, NORMAL, 0);
|
||||||
|
|
||||||
return Dictionary::cast(obj)->AddEntry(
|
return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details,
|
||||||
key, value, details, Dictionary::Hash(key));
|
Dictionary<Shape, Key>::Hash(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
MaybeObject* Dictionary<Derived, Shape, Key>::Add(
|
MaybeObject* Dictionary<Shape, Key>::Add(Key key,
|
||||||
Key key,
|
Object* value,
|
||||||
Object* value,
|
PropertyDetails details) {
|
||||||
PropertyDetails details) {
|
|
||||||
// Valdate key is absent.
|
// Valdate key is absent.
|
||||||
SLOW_ASSERT((this->FindEntry(key) == Dictionary::kNotFound));
|
SLOW_ASSERT((this->FindEntry(key) == Dictionary<Shape, Key>::kNotFound));
|
||||||
// Check whether the dictionary should be extended.
|
// Check whether the dictionary should be extended.
|
||||||
Object* obj;
|
Object* obj;
|
||||||
{ MaybeObject* maybe_obj = EnsureCapacity(1, key);
|
{ MaybeObject* maybe_obj = EnsureCapacity(1, key);
|
||||||
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Dictionary::cast(obj)->AddEntry(
|
return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details,
|
||||||
key, value, details, Dictionary::Hash(key));
|
Dictionary<Shape, Key>::Hash(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add a key, value pair to the dictionary.
|
// Add a key, value pair to the dictionary.
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
MaybeObject* Dictionary<Derived, Shape, Key>::AddEntry(
|
MaybeObject* Dictionary<Shape, Key>::AddEntry(Key key,
|
||||||
Key key,
|
Object* value,
|
||||||
Object* value,
|
PropertyDetails details,
|
||||||
PropertyDetails details,
|
uint32_t hash) {
|
||||||
uint32_t hash) {
|
|
||||||
// Compute the key object.
|
// Compute the key object.
|
||||||
Object* k;
|
Object* k;
|
||||||
{ MaybeObject* maybe_k = Shape::AsObject(this->GetHeap(), key);
|
{ MaybeObject* maybe_k = Shape::AsObject(this->GetHeap(), key);
|
||||||
if (!maybe_k->ToObject(&k)) return maybe_k;
|
if (!maybe_k->ToObject(&k)) return maybe_k;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t entry = Dictionary::FindInsertionEntry(hash);
|
uint32_t entry = Dictionary<Shape, Key>::FindInsertionEntry(hash);
|
||||||
// Insert element at empty or deleted entry
|
// Insert element at empty or deleted entry
|
||||||
if (!details.IsDeleted() &&
|
if (!details.IsDeleted() &&
|
||||||
details.dictionary_index() == 0 &&
|
details.dictionary_index() == 0 &&
|
||||||
@ -15378,9 +15346,9 @@ MaybeObject* Dictionary<Derived, Shape, Key>::AddEntry(
|
|||||||
SetNextEnumerationIndex(index + 1);
|
SetNextEnumerationIndex(index + 1);
|
||||||
}
|
}
|
||||||
SetEntry(entry, k, value, details);
|
SetEntry(entry, k, value, details);
|
||||||
ASSERT((Dictionary::KeyAt(entry)->IsNumber() ||
|
ASSERT((Dictionary<Shape, Key>::KeyAt(entry)->IsNumber() ||
|
||||||
Dictionary::KeyAt(entry)->IsName()));
|
Dictionary<Shape, Key>::KeyAt(entry)->IsName()));
|
||||||
DerivedHashTable::ElementAdded();
|
HashTable<Shape, Key>::ElementAdded();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15494,14 +15462,14 @@ MaybeObject* UnseededNumberDictionary::Set(uint32_t key,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
int Dictionary<Derived, Shape, Key>::NumberOfElementsFilterAttributes(
|
int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes(
|
||||||
PropertyAttributes filter) {
|
PropertyAttributes filter) {
|
||||||
int capacity = DerivedHashTable::Capacity();
|
int capacity = HashTable<Shape, Key>::Capacity();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
Object* k = DerivedHashTable::KeyAt(i);
|
Object* k = HashTable<Shape, Key>::KeyAt(i);
|
||||||
if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
|
if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
|
||||||
PropertyDetails details = DetailsAt(i);
|
PropertyDetails details = DetailsAt(i);
|
||||||
if (details.IsDeleted()) continue;
|
if (details.IsDeleted()) continue;
|
||||||
PropertyAttributes attr = details.attributes();
|
PropertyAttributes attr = details.attributes();
|
||||||
@ -15512,31 +15480,31 @@ int Dictionary<Derived, Shape, Key>::NumberOfElementsFilterAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
int Dictionary<Derived, Shape, Key>::NumberOfEnumElements() {
|
int Dictionary<Shape, Key>::NumberOfEnumElements() {
|
||||||
return NumberOfElementsFilterAttributes(
|
return NumberOfElementsFilterAttributes(
|
||||||
static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC));
|
static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void Dictionary<Derived, Shape, Key>::CopyKeysTo(
|
void Dictionary<Shape, Key>::CopyKeysTo(
|
||||||
FixedArray* storage,
|
FixedArray* storage,
|
||||||
PropertyAttributes filter,
|
PropertyAttributes filter,
|
||||||
typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) {
|
typename Dictionary<Shape, Key>::SortMode sort_mode) {
|
||||||
ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
|
ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
|
||||||
int capacity = DerivedHashTable::Capacity();
|
int capacity = HashTable<Shape, Key>::Capacity();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
Object* k = DerivedHashTable::KeyAt(i);
|
Object* k = HashTable<Shape, Key>::KeyAt(i);
|
||||||
if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
|
if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
|
||||||
PropertyDetails details = DetailsAt(i);
|
PropertyDetails details = DetailsAt(i);
|
||||||
if (details.IsDeleted()) continue;
|
if (details.IsDeleted()) continue;
|
||||||
PropertyAttributes attr = details.attributes();
|
PropertyAttributes attr = details.attributes();
|
||||||
if ((attr & filter) == 0) storage->set(index++, k);
|
if ((attr & filter) == 0) storage->set(index++, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sort_mode == Dictionary::SORTED) {
|
if (sort_mode == Dictionary<Shape, Key>::SORTED) {
|
||||||
storage->SortPairs(storage, index);
|
storage->SortPairs(storage, index);
|
||||||
}
|
}
|
||||||
ASSERT(storage->length() >= index);
|
ASSERT(storage->length() >= index);
|
||||||
@ -15578,24 +15546,24 @@ void NameDictionary::CopyEnumKeysTo(FixedArray* storage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
void Dictionary<Derived, Shape, Key>::CopyKeysTo(
|
void Dictionary<Shape, Key>::CopyKeysTo(
|
||||||
FixedArray* storage,
|
FixedArray* storage,
|
||||||
int index,
|
int index,
|
||||||
PropertyAttributes filter,
|
PropertyAttributes filter,
|
||||||
typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) {
|
typename Dictionary<Shape, Key>::SortMode sort_mode) {
|
||||||
ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
|
ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
|
||||||
int capacity = DerivedHashTable::Capacity();
|
int capacity = HashTable<Shape, Key>::Capacity();
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
Object* k = DerivedHashTable::KeyAt(i);
|
Object* k = HashTable<Shape, Key>::KeyAt(i);
|
||||||
if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
|
if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
|
||||||
PropertyDetails details = DetailsAt(i);
|
PropertyDetails details = DetailsAt(i);
|
||||||
if (details.IsDeleted()) continue;
|
if (details.IsDeleted()) continue;
|
||||||
PropertyAttributes attr = details.attributes();
|
PropertyAttributes attr = details.attributes();
|
||||||
if ((attr & filter) == 0) storage->set(index++, k);
|
if ((attr & filter) == 0) storage->set(index++, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sort_mode == Dictionary::SORTED) {
|
if (sort_mode == Dictionary<Shape, Key>::SORTED) {
|
||||||
storage->SortPairs(storage, index);
|
storage->SortPairs(storage, index);
|
||||||
}
|
}
|
||||||
ASSERT(storage->length() >= index);
|
ASSERT(storage->length() >= index);
|
||||||
@ -15603,12 +15571,12 @@ void Dictionary<Derived, Shape, Key>::CopyKeysTo(
|
|||||||
|
|
||||||
|
|
||||||
// Backwards lookup (slow).
|
// Backwards lookup (slow).
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
Object* Dictionary<Derived, Shape, Key>::SlowReverseLookup(Object* value) {
|
Object* Dictionary<Shape, Key>::SlowReverseLookup(Object* value) {
|
||||||
int capacity = DerivedHashTable::Capacity();
|
int capacity = HashTable<Shape, Key>::Capacity();
|
||||||
for (int i = 0; i < capacity; i++) {
|
for (int i = 0; i < capacity; i++) {
|
||||||
Object* k = DerivedHashTable::KeyAt(i);
|
Object* k = HashTable<Shape, Key>::KeyAt(i);
|
||||||
if (Dictionary::IsKey(k)) {
|
if (Dictionary<Shape, Key>::IsKey(k)) {
|
||||||
Object* e = ValueAt(i);
|
Object* e = ValueAt(i);
|
||||||
if (e->IsPropertyCell()) {
|
if (e->IsPropertyCell()) {
|
||||||
e = PropertyCell::cast(e)->value();
|
e = PropertyCell::cast(e)->value();
|
||||||
@ -15616,7 +15584,7 @@ Object* Dictionary<Derived, Shape, Key>::SlowReverseLookup(Object* value) {
|
|||||||
if (e == value) return k;
|
if (e == value) return k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Heap* heap = Dictionary::GetHeap();
|
Heap* heap = Dictionary<Shape, Key>::GetHeap();
|
||||||
return heap->undefined_value();
|
return heap->undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15626,15 +15594,22 @@ Handle<ObjectHashTable> ObjectHashTable::EnsureCapacity(
|
|||||||
int n,
|
int n,
|
||||||
Handle<Object> key,
|
Handle<Object> key,
|
||||||
PretenureFlag pretenure) {
|
PretenureFlag pretenure) {
|
||||||
Handle<HashTable<ObjectHashTable,
|
Handle<HashTable<ObjectHashTableShape, Object*> > table_base = table;
|
||||||
ObjectHashTableShape,
|
|
||||||
Object*> > table_base = table;
|
|
||||||
CALL_HEAP_FUNCTION(table_base->GetIsolate(),
|
CALL_HEAP_FUNCTION(table_base->GetIsolate(),
|
||||||
table_base->EnsureCapacity(n, *key, pretenure),
|
table_base->EnsureCapacity(n, *key, pretenure),
|
||||||
ObjectHashTable);
|
ObjectHashTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Handle<ObjectHashTable> ObjectHashTable::Shrink(
|
||||||
|
Handle<ObjectHashTable> table, Handle<Object> key) {
|
||||||
|
Handle<HashTable<ObjectHashTableShape, Object*> > table_base = table;
|
||||||
|
CALL_HEAP_FUNCTION(table_base->GetIsolate(),
|
||||||
|
table_base->Shrink(*key),
|
||||||
|
ObjectHashTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Object* ObjectHashTable::Lookup(Object* key) {
|
Object* ObjectHashTable::Lookup(Object* key) {
|
||||||
ASSERT(IsKey(key));
|
ASSERT(IsKey(key));
|
||||||
|
|
||||||
|
@ -3656,7 +3656,7 @@ class BaseShape {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Derived, typename Shape, typename Key>
|
template<typename Shape, typename Key>
|
||||||
class HashTable: public FixedArray {
|
class HashTable: public FixedArray {
|
||||||
public:
|
public:
|
||||||
// Wrapper methods
|
// Wrapper methods
|
||||||
@ -3709,20 +3709,12 @@ class HashTable: public FixedArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns a new HashTable object. Might return Failure.
|
// Returns a new HashTable object. Might return Failure.
|
||||||
// TODO(ishell): this will be eventually replaced by New().
|
|
||||||
MUST_USE_RESULT static MaybeObject* Allocate(
|
MUST_USE_RESULT static MaybeObject* Allocate(
|
||||||
Heap* heap,
|
Heap* heap,
|
||||||
int at_least_space_for,
|
int at_least_space_for,
|
||||||
MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY,
|
MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY,
|
||||||
PretenureFlag pretenure = NOT_TENURED);
|
PretenureFlag pretenure = NOT_TENURED);
|
||||||
|
|
||||||
// Returns a new HashTable object.
|
|
||||||
static Handle<Derived> New(
|
|
||||||
Isolate* isolate,
|
|
||||||
int at_least_space_for,
|
|
||||||
MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY,
|
|
||||||
PretenureFlag pretenure = NOT_TENURED);
|
|
||||||
|
|
||||||
// Computes the required capacity for a table holding the given
|
// Computes the required capacity for a table holding the given
|
||||||
// number of elements. May be more than HashTable::kMaxCapacity.
|
// number of elements. May be more than HashTable::kMaxCapacity.
|
||||||
static int ComputeCapacity(int at_least_space_for);
|
static int ComputeCapacity(int at_least_space_for);
|
||||||
@ -3832,10 +3824,10 @@ class HashTable: public FixedArray {
|
|||||||
void Swap(uint32_t entry1, uint32_t entry2, WriteBarrierMode mode);
|
void Swap(uint32_t entry1, uint32_t entry2, WriteBarrierMode mode);
|
||||||
|
|
||||||
// Rehashes this hash-table into the new table.
|
// Rehashes this hash-table into the new table.
|
||||||
void Rehash(Derived* new_table, Key key);
|
MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key);
|
||||||
|
|
||||||
// Attempt to shrink hash table after removal of key.
|
// Attempt to shrink hash table after removal of key.
|
||||||
static Handle<Derived> Shrink(Handle<Derived> table, Key key);
|
MUST_USE_RESULT MaybeObject* Shrink(Key key);
|
||||||
|
|
||||||
// Ensure enough space for n additional elements.
|
// Ensure enough space for n additional elements.
|
||||||
MUST_USE_RESULT MaybeObject* EnsureCapacity(
|
MUST_USE_RESULT MaybeObject* EnsureCapacity(
|
||||||
@ -3888,9 +3880,7 @@ class SeqOneByteString;
|
|||||||
//
|
//
|
||||||
// No special elements in the prefix and the element size is 1
|
// No special elements in the prefix and the element size is 1
|
||||||
// because only the string itself (the key) needs to be stored.
|
// because only the string itself (the key) needs to be stored.
|
||||||
class StringTable: public HashTable<StringTable,
|
class StringTable: public HashTable<StringTableShape, HashTableKey*> {
|
||||||
StringTableShape,
|
|
||||||
HashTableKey*> {
|
|
||||||
public:
|
public:
|
||||||
// Find string in the string table. If it is not there yet, it is
|
// Find string in the string table. If it is not there yet, it is
|
||||||
// added. The return value is the string table which might have
|
// added. The return value is the string table which might have
|
||||||
@ -3942,7 +3932,7 @@ class MapCacheShape : public BaseShape<HashTableKey*> {
|
|||||||
//
|
//
|
||||||
// Maps keys that are a fixed array of unique names to a map.
|
// Maps keys that are a fixed array of unique names to a map.
|
||||||
// Used for canonicalize maps for object literals.
|
// Used for canonicalize maps for object literals.
|
||||||
class MapCache: public HashTable<MapCache, MapCacheShape, HashTableKey*> {
|
class MapCache: public HashTable<MapCacheShape, HashTableKey*> {
|
||||||
public:
|
public:
|
||||||
// Find cached value for a name key, otherwise return null.
|
// Find cached value for a name key, otherwise return null.
|
||||||
Object* Lookup(FixedArray* key);
|
Object* Lookup(FixedArray* key);
|
||||||
@ -3954,36 +3944,33 @@ class MapCache: public HashTable<MapCache, MapCacheShape, HashTableKey*> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename Derived, typename Shape, typename Key>
|
template <typename Shape, typename Key>
|
||||||
class Dictionary: public HashTable<Derived, Shape, Key> {
|
class Dictionary: public HashTable<Shape, Key> {
|
||||||
protected:
|
|
||||||
typedef HashTable<Derived, Shape, Key> DerivedHashTable;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static inline Dictionary* cast(Object* obj) {
|
static inline Dictionary<Shape, Key>* cast(Object* obj) {
|
||||||
return reinterpret_cast<Dictionary*>(obj);
|
return reinterpret_cast<Dictionary<Shape, Key>*>(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the value at entry.
|
// Returns the value at entry.
|
||||||
Object* ValueAt(int entry) {
|
Object* ValueAt(int entry) {
|
||||||
return this->get(DerivedHashTable::EntryToIndex(entry) + 1);
|
return this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the value for entry.
|
// Set the value for entry.
|
||||||
void ValueAtPut(int entry, Object* value) {
|
void ValueAtPut(int entry, Object* value) {
|
||||||
this->set(DerivedHashTable::EntryToIndex(entry) + 1, value);
|
this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 1, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the property details for the property at entry.
|
// Returns the property details for the property at entry.
|
||||||
PropertyDetails DetailsAt(int entry) {
|
PropertyDetails DetailsAt(int entry) {
|
||||||
ASSERT(entry >= 0); // Not found is -1, which is not caught by get().
|
ASSERT(entry >= 0); // Not found is -1, which is not caught by get().
|
||||||
return PropertyDetails(
|
return PropertyDetails(
|
||||||
Smi::cast(this->get(DerivedHashTable::EntryToIndex(entry) + 2)));
|
Smi::cast(this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the details for entry.
|
// Set the details for entry.
|
||||||
void DetailsAtPut(int entry, PropertyDetails value) {
|
void DetailsAtPut(int entry, PropertyDetails value) {
|
||||||
this->set(DerivedHashTable::EntryToIndex(entry) + 2, value.AsSmi());
|
this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 2, value.AsSmi());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sorting support
|
// Sorting support
|
||||||
@ -3993,14 +3980,16 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
|
|||||||
Object* DeleteProperty(int entry, JSObject::DeleteMode mode);
|
Object* DeleteProperty(int entry, JSObject::DeleteMode mode);
|
||||||
// TODO(ishell): Temporary wrapper until handlified.
|
// TODO(ishell): Temporary wrapper until handlified.
|
||||||
static Handle<Object> DeleteProperty(
|
static Handle<Object> DeleteProperty(
|
||||||
Handle<Dictionary> dictionary,
|
Handle<Dictionary<Shape, Key> > dictionary,
|
||||||
int entry,
|
int entry,
|
||||||
JSObject::DeleteMode mode);
|
JSObject::DeleteMode mode);
|
||||||
|
|
||||||
// Attempt to shrink the dictionary after deletion of key.
|
// Attempt to shrink the dictionary after deletion of key.
|
||||||
static inline Handle<Derived> Shrink(Handle<Derived> dictionary, Key key) {
|
MUST_USE_RESULT MaybeObject* Shrink(Key key);
|
||||||
return DerivedHashTable::Shrink(dictionary, key);
|
// TODO(ishell): Temporary wrapper until handlified.
|
||||||
}
|
MUST_USE_RESULT static Handle<FixedArray> Shrink(
|
||||||
|
Handle<Dictionary<Shape, Key> > dictionary,
|
||||||
|
Key key);
|
||||||
|
|
||||||
// Returns the number of elements in the dictionary filtering out properties
|
// Returns the number of elements in the dictionary filtering out properties
|
||||||
// with the specified attributes.
|
// with the specified attributes.
|
||||||
@ -4070,7 +4059,8 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
|
|||||||
|
|
||||||
// Generate new enumeration indices to avoid enumeration index overflow.
|
// Generate new enumeration indices to avoid enumeration index overflow.
|
||||||
MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices();
|
MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices();
|
||||||
static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex;
|
static const int kMaxNumberKeyIndex =
|
||||||
|
HashTable<Shape, Key>::kPrefixStartIndex;
|
||||||
static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
|
static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4088,9 +4078,7 @@ class NameDictionaryShape : public BaseShape<Name*> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class NameDictionary: public Dictionary<NameDictionary,
|
class NameDictionary: public Dictionary<NameDictionaryShape, Name*> {
|
||||||
NameDictionaryShape,
|
|
||||||
Name*> {
|
|
||||||
public:
|
public:
|
||||||
static inline NameDictionary* cast(Object* obj) {
|
static inline NameDictionary* cast(Object* obj) {
|
||||||
ASSERT(obj->IsDictionary());
|
ASSERT(obj->IsDictionary());
|
||||||
@ -4140,9 +4128,7 @@ class UnseededNumberDictionaryShape : public NumberDictionaryShape {
|
|||||||
|
|
||||||
|
|
||||||
class SeededNumberDictionary
|
class SeededNumberDictionary
|
||||||
: public Dictionary<SeededNumberDictionary,
|
: public Dictionary<SeededNumberDictionaryShape, uint32_t> {
|
||||||
SeededNumberDictionaryShape,
|
|
||||||
uint32_t> {
|
|
||||||
public:
|
public:
|
||||||
static SeededNumberDictionary* cast(Object* obj) {
|
static SeededNumberDictionary* cast(Object* obj) {
|
||||||
ASSERT(obj->IsDictionary());
|
ASSERT(obj->IsDictionary());
|
||||||
@ -4195,9 +4181,7 @@ class SeededNumberDictionary
|
|||||||
|
|
||||||
|
|
||||||
class UnseededNumberDictionary
|
class UnseededNumberDictionary
|
||||||
: public Dictionary<UnseededNumberDictionary,
|
: public Dictionary<UnseededNumberDictionaryShape, uint32_t> {
|
||||||
UnseededNumberDictionaryShape,
|
|
||||||
uint32_t> {
|
|
||||||
public:
|
public:
|
||||||
static UnseededNumberDictionary* cast(Object* obj) {
|
static UnseededNumberDictionary* cast(Object* obj) {
|
||||||
ASSERT(obj->IsDictionary());
|
ASSERT(obj->IsDictionary());
|
||||||
@ -4233,10 +4217,7 @@ class ObjectHashTableShape : public BaseShape<Object*> {
|
|||||||
|
|
||||||
// ObjectHashTable maps keys that are arbitrary objects to object values by
|
// ObjectHashTable maps keys that are arbitrary objects to object values by
|
||||||
// using the identity hash of the key for hashing purposes.
|
// using the identity hash of the key for hashing purposes.
|
||||||
class ObjectHashTable: public HashTable<ObjectHashTable,
|
class ObjectHashTable: public HashTable<ObjectHashTableShape, Object*> {
|
||||||
ObjectHashTableShape,
|
|
||||||
Object*> {
|
|
||||||
typedef HashTable<ObjectHashTable, ObjectHashTableShape, Object*> HashTable_;
|
|
||||||
public:
|
public:
|
||||||
static inline ObjectHashTable* cast(Object* obj) {
|
static inline ObjectHashTable* cast(Object* obj) {
|
||||||
ASSERT(obj->IsHashTable());
|
ASSERT(obj->IsHashTable());
|
||||||
@ -4250,8 +4231,8 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
|
|||||||
PretenureFlag pretenure = NOT_TENURED);
|
PretenureFlag pretenure = NOT_TENURED);
|
||||||
|
|
||||||
// Attempt to shrink hash table after removal of key.
|
// Attempt to shrink hash table after removal of key.
|
||||||
static inline Handle<ObjectHashTable> Shrink(Handle<ObjectHashTable> table,
|
static Handle<ObjectHashTable> Shrink(Handle<ObjectHashTable> table,
|
||||||
Handle<Object> key);
|
Handle<Object> key);
|
||||||
|
|
||||||
// Looks up the value associated with the given key. The hole value is
|
// Looks up the value associated with the given key. The hole value is
|
||||||
// returned in case the key is not present.
|
// returned in case the key is not present.
|
||||||
@ -4449,9 +4430,7 @@ class WeakHashTableShape : public BaseShape<Object*> {
|
|||||||
// WeakHashTable maps keys that are arbitrary objects to object values.
|
// WeakHashTable maps keys that are arbitrary objects to object values.
|
||||||
// It is used for the global weak hash table that maps objects
|
// It is used for the global weak hash table that maps objects
|
||||||
// embedded in optimized code to dependent code lists.
|
// embedded in optimized code to dependent code lists.
|
||||||
class WeakHashTable: public HashTable<WeakHashTable,
|
class WeakHashTable: public HashTable<WeakHashTableShape<2>, Object*> {
|
||||||
WeakHashTableShape<2>,
|
|
||||||
Object*> {
|
|
||||||
public:
|
public:
|
||||||
static inline WeakHashTable* cast(Object* obj) {
|
static inline WeakHashTable* cast(Object* obj) {
|
||||||
ASSERT(obj->IsHashTable());
|
ASSERT(obj->IsHashTable());
|
||||||
@ -8221,8 +8200,7 @@ class CompilationCacheShape : public BaseShape<HashTableKey*> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CompilationCacheTable: public HashTable<CompilationCacheTable,
|
class CompilationCacheTable: public HashTable<CompilationCacheShape,
|
||||||
CompilationCacheShape,
|
|
||||||
HashTableKey*> {
|
HashTableKey*> {
|
||||||
public:
|
public:
|
||||||
// Find cached value for a string key, otherwise return null.
|
// Find cached value for a string key, otherwise return null.
|
||||||
@ -8323,8 +8301,7 @@ class CodeCacheHashTableShape : public BaseShape<HashTableKey*> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CodeCacheHashTable: public HashTable<CodeCacheHashTable,
|
class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape,
|
||||||
CodeCacheHashTableShape,
|
|
||||||
HashTableKey*> {
|
HashTableKey*> {
|
||||||
public:
|
public:
|
||||||
Object* Lookup(Name* name, Code::Flags flags);
|
Object* Lookup(Name* name, Code::Flags flags);
|
||||||
@ -8374,9 +8351,7 @@ class PolymorphicCodeCache: public Struct {
|
|||||||
|
|
||||||
|
|
||||||
class PolymorphicCodeCacheHashTable
|
class PolymorphicCodeCacheHashTable
|
||||||
: public HashTable<PolymorphicCodeCacheHashTable,
|
: public HashTable<CodeCacheHashTableShape, HashTableKey*> {
|
||||||
CodeCacheHashTableShape,
|
|
||||||
HashTableKey*> {
|
|
||||||
public:
|
public:
|
||||||
Object* Lookup(MapHandleList* maps, int code_kind);
|
Object* Lookup(MapHandleList* maps, int code_kind);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user