Revision: 20734
Author: ish...@chromium.org
Date: Mon Apr 14 15:56:57 2014 UTC
Log: Reland "HashTable::Shrink() handlified and derived template
parameter added to HashTable hierarchy."
R=yang...@chromium.org
Review URL: https://codereview.chromium.org/227423004
http://code.google.com/p/v8/source/detail?r=20734
Modified:
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Mon Apr 14 13:25:16 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h Mon Apr 14 15:56:57 2014 UTC
@@ -865,8 +865,7 @@
bool Object::IsStringTable() {
- return IsHashTable() &&
- this ==
HeapObject::cast(this)->GetHeap()->raw_unchecked_string_table();
+ return IsHashTable();
}
@@ -2882,8 +2881,8 @@
}
-template<typename Shape, typename Key>
-int HashTable<Shape, Key>::ComputeCapacity(int at_least_space_for) {
+template<typename Derived, typename Shape, typename Key>
+int HashTable<Derived, Shape, Key>::ComputeCapacity(int
at_least_space_for) {
const int kMinCapacity = 32;
int capacity = RoundUpToPowerOf2(at_least_space_for * 2);
if (capacity < kMinCapacity) {
@@ -2893,17 +2892,17 @@
}
-template<typename Shape, typename Key>
-int HashTable<Shape, Key>::FindEntry(Key key) {
+template<typename Derived, typename Shape, typename Key>
+int HashTable<Derived, Shape, Key>::FindEntry(Key key) {
return FindEntry(GetIsolate(), key);
}
// Find entry for key otherwise return kNotFound.
-template<typename Shape, typename Key>
-int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) {
+template<typename Derived, typename Shape, typename Key>
+int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) {
uint32_t capacity = Capacity();
- uint32_t entry = FirstProbe(HashTable<Shape, Key>::Hash(key), capacity);
+ uint32_t entry = FirstProbe(HashTable::Hash(key), capacity);
uint32_t count = 1;
// EnsureCapacity will guarantee the hash table is never full.
while (true) {
@@ -3028,8 +3027,9 @@
#undef MAKE_STRUCT_CAST
-template <typename Shape, typename Key>
-HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
+template <typename Derived, typename Shape, typename Key>
+HashTable<Derived, Shape, Key>*
+HashTable<Derived, Shape, Key>::cast(Object* obj) {
ASSERT(obj->IsHashTable());
return reinterpret_cast<HashTable*>(obj);
}
@@ -6671,23 +6671,23 @@
}
-template<typename Shape, typename Key>
-void Dictionary<Shape, Key>::SetEntry(int entry,
- Object* key,
- Object* value) {
+template<typename Derived, typename Shape, typename Key>
+void Dictionary<Derived, Shape, Key>::SetEntry(int entry,
+ Object* key,
+ Object* value) {
SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0)));
}
-template<typename Shape, typename Key>
-void Dictionary<Shape, Key>::SetEntry(int entry,
- Object* key,
- Object* value,
- PropertyDetails details) {
+template<typename Derived, typename Shape, typename Key>
+void Dictionary<Derived, Shape, Key>::SetEntry(int entry,
+ Object* key,
+ Object* value,
+ PropertyDetails details) {
ASSERT(!key->IsName() ||
details.IsDeleted() ||
details.dictionary_index() > 0);
- int index = HashTable<Shape, Key>::EntryToIndex(entry);
+ int index = DerivedHashTable::EntryToIndex(entry);
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc);
FixedArray::set(index, key, mode);
@@ -6771,6 +6771,12 @@
MaybeObject* ObjectHashTableShape::AsObject(Heap* heap, Object* key) {
return key;
}
+
+
+Handle<ObjectHashTable> ObjectHashTable::Shrink(
+ Handle<ObjectHashTable> table, Handle<Object> key) {
+ return HashTable_::Shrink(table, *key);
+}
template <int entrysize>
=======================================
--- /branches/bleeding_edge/src/objects.cc Mon Apr 14 14:34:37 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Mon Apr 14 15:56:57 2014 UTC
@@ -694,13 +694,6 @@
property_dictionary->SetEntry(entry, *name, *value, details);
}
}
-
-
-// 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,
@@ -732,7 +725,7 @@
Handle<Object> deleted(dictionary->DeleteProperty(entry, mode),
isolate);
if (*deleted == isolate->heap()->true_value()) {
Handle<NameDictionary> new_properties =
- NameDictionaryShrink(dictionary, name);
+ NameDictionary::Shrink(dictionary, *name);
object->set_properties(*new_properties);
}
return deleted;
@@ -13176,12 +13169,12 @@
// together, so even though this function belongs in objects-debug.cc,
// we keep it here instead to satisfy certain compilers.
#ifdef OBJECT_PRINT
-template<typename Shape, typename Key>
-void Dictionary<Shape, Key>::Print(FILE* out) {
- int capacity = HashTable<Shape, Key>::Capacity();
+template<typename Derived, typename Shape, typename Key>
+void Dictionary<Derived, Shape, Key>::Print(FILE* out) {
+ int capacity = DerivedHashTable::Capacity();
for (int i = 0; i < capacity; i++) {
- Object* k = HashTable<Shape, Key>::KeyAt(i);
- if (HashTable<Shape, Key>::IsKey(k)) {
+ Object* k = DerivedHashTable::KeyAt(i);
+ if (DerivedHashTable::IsKey(k)) {
PrintF(out, " ");
if (k->IsString()) {
String::cast(k)->StringPrint(out);
@@ -13197,15 +13190,15 @@
#endif
-template<typename Shape, typename Key>
-void Dictionary<Shape, Key>::CopyValuesTo(FixedArray* elements) {
+template<typename Derived, typename Shape, typename Key>
+void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) {
int pos = 0;
- int capacity = HashTable<Shape, Key>::Capacity();
+ int capacity = DerivedHashTable::Capacity();
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
for (int i = 0; i < capacity; i++) {
- Object* k = Dictionary<Shape, Key>::KeyAt(i);
- if (Dictionary<Shape, Key>::IsKey(k)) {
+ Object* k = Dictionary::KeyAt(i);
+ if (Dictionary::IsKey(k)) {
elements->set(pos++, ValueAt(i), mode);
}
}
@@ -13912,25 +13905,26 @@
};
-template<typename Shape, typename Key>
-void HashTable<Shape, Key>::IteratePrefix(ObjectVisitor* v) {
+template<typename Derived, typename Shape, typename Key>
+void HashTable<Derived, Shape, Key>::IteratePrefix(ObjectVisitor* v) {
IteratePointers(v, 0, kElementsStartOffset);
}
-template<typename Shape, typename Key>
-void HashTable<Shape, Key>::IterateElements(ObjectVisitor* v) {
+template<typename Derived, typename Shape, typename Key>
+void HashTable<Derived, Shape, Key>::IterateElements(ObjectVisitor* v) {
IteratePointers(v,
kElementsStartOffset,
kHeaderSize + length() * kPointerSize);
}
-template<typename Shape, typename Key>
-MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap,
- int at_least_space_for,
- MinimumCapacity
capacity_option,
- PretenureFlag pretenure) {
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* HashTable<Derived, Shape, Key>::Allocate(
+ Heap* heap,
+ int at_least_space_for,
+ MinimumCapacity capacity_option,
+ PretenureFlag pretenure) {
ASSERT(!capacity_option || IsPowerOf2(at_least_space_for));
int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
? at_least_space_for
@@ -13950,11 +13944,24 @@
return obj;
}
+
+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.
int NameDictionary::FindEntry(Name* key) {
if (!key->IsUniqueName()) {
- return HashTable<NameDictionaryShape, Name*>::FindEntry(key);
+ return DerivedHashTable::FindEntry(key);
}
// Optimized for unique names. Knowledge of the key type allows:
@@ -13991,8 +13998,8 @@
}
-template<typename Shape, typename Key>
-MaybeObject* HashTable<Shape, Key>::Rehash(HashTable* new_table, Key key) {
+template<typename Derived, typename Shape, typename Key>
+void HashTable<Derived, Shape, Key>::Rehash(Derived* new_table, Key key) {
ASSERT(NumberOfElements() < new_table->Capacity());
DisallowHeapAllocation no_gc;
@@ -14011,7 +14018,7 @@
uint32_t from_index = EntryToIndex(i);
Object* k = get(from_index);
if (IsKey(k)) {
- uint32_t hash = HashTable<Shape, Key>::HashForObject(key, k);
+ uint32_t hash = HashTable::HashForObject(key, k);
uint32_t insertion_index =
EntryToIndex(new_table->FindInsertionEntry(hash));
for (int j = 0; j < Shape::kEntrySize; j++) {
@@ -14021,16 +14028,16 @@
}
new_table->SetNumberOfElements(NumberOfElements());
new_table->SetNumberOfDeletedElements(0);
- return new_table;
}
-template<typename Shape, typename Key>
-uint32_t HashTable<Shape, Key>::EntryForProbe(Key key,
- Object* k,
- int probe,
- uint32_t expected) {
- uint32_t hash = HashTable<Shape, Key>::HashForObject(key, k);
+template<typename Derived, typename Shape, typename Key>
+uint32_t HashTable<Derived, Shape, Key>::EntryForProbe(
+ Key key,
+ Object* k,
+ int probe,
+ uint32_t expected) {
+ uint32_t hash = HashTable::HashForObject(key, k);
uint32_t capacity = Capacity();
uint32_t entry = FirstProbe(hash, capacity);
for (int i = 1; i < probe; i++) {
@@ -14041,10 +14048,10 @@
}
-template<typename Shape, typename Key>
-void HashTable<Shape, Key>::Swap(uint32_t entry1,
- uint32_t entry2,
- WriteBarrierMode mode) {
+template<typename Derived, typename Shape, typename Key>
+void HashTable<Derived, Shape, Key>::Swap(uint32_t entry1,
+ uint32_t entry2,
+ WriteBarrierMode mode) {
int index1 = EntryToIndex(entry1);
int index2 = EntryToIndex(entry2);
Object* temp[Shape::kEntrySize];
@@ -14060,8 +14067,8 @@
}
-template<typename Shape, typename Key>
-void HashTable<Shape, Key>::Rehash(Key key) {
+template<typename Derived, typename Shape, typename Key>
+void HashTable<Derived, Shape, Key>::Rehash(Key key) {
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = GetWriteBarrierMode(no_gc);
uint32_t capacity = Capacity();
@@ -14093,10 +14100,11 @@
}
-template<typename Shape, typename Key>
-MaybeObject* HashTable<Shape, Key>::EnsureCapacity(int n,
- Key key,
- PretenureFlag
pretenure) {
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* HashTable<Derived, Shape, Key>::EnsureCapacity(
+ int n,
+ Key key,
+ PretenureFlag pretenure) {
int capacity = Capacity();
int nof = NumberOfElements() + n;
int nod = NumberOfDeletedElements();
@@ -14120,44 +14128,45 @@
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
}
- return Rehash(HashTable::cast(obj), key);
+ Rehash(Derived::cast(obj), key);
+ return Derived::cast(obj);
}
-template<typename Shape, typename Key>
-MaybeObject* HashTable<Shape, Key>::Shrink(Key key) {
- int capacity = Capacity();
- int nof = NumberOfElements();
+template<typename Derived, typename Shape, typename Key>
+Handle<Derived> HashTable<Derived, Shape, Key>::Shrink(Handle<Derived>
table,
+ Key key) {
+ int capacity = table->Capacity();
+ int nof = table->NumberOfElements();
// Shrink to fit the number of elements if only a quarter of the
// capacity is filled with elements.
- if (nof > (capacity >> 2)) return this;
+ if (nof > (capacity >> 2)) return table;
// Allocate a new dictionary with room for at least the current
// number of elements. The allocation method will make sure that
// there is extra room in the dictionary for additions. Don't go
// lower than room for 16 elements.
int at_least_room_for = nof;
- if (at_least_room_for < 16) return this;
+ if (at_least_room_for < 16) return table;
+ Isolate* isolate = table->GetIsolate();
const int kMinCapacityForPretenure = 256;
bool pretenure =
(at_least_room_for > kMinCapacityForPretenure) &&
- !GetHeap()->InNewSpace(this);
- Object* obj;
- { MaybeObject* maybe_obj =
- Allocate(GetHeap(),
- at_least_room_for,
- USE_DEFAULT_MINIMUM_CAPACITY,
- pretenure ? TENURED : NOT_TENURED);
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
- }
+ !isolate->heap()->InNewSpace(*table);
+ Handle<Derived> new_table = New(
+ isolate,
+ at_least_room_for,
+ USE_DEFAULT_MINIMUM_CAPACITY,
+ pretenure ? TENURED : NOT_TENURED);
- return Rehash(HashTable::cast(obj), key);
+ table->Rehash(*new_table, key);
+ return new_table;
}
-template<typename Shape, typename Key>
-uint32_t HashTable<Shape, Key>::FindInsertionEntry(uint32_t hash) {
+template<typename Derived, typename Shape, typename Key>
+uint32_t HashTable<Derived, Shape, Key>::FindInsertionEntry(uint32_t hash)
{
uint32_t capacity = Capacity();
uint32_t entry = FirstProbe(hash, capacity);
uint32_t count = 1;
@@ -14174,129 +14183,165 @@
// Force instantiation of template instances class.
// Please note this list is compiler dependent.
-template class HashTable<StringTableShape, HashTableKey*>;
+template class HashTable<StringTable, StringTableShape, HashTableKey*>;
-template class HashTable<CompilationCacheShape, HashTableKey*>;
+template class HashTable<CompilationCacheTable,
+ CompilationCacheShape,
+ HashTableKey*>;
-template class HashTable<MapCacheShape, HashTableKey*>;
+template class HashTable<MapCache, MapCacheShape, HashTableKey*>;
-template class HashTable<ObjectHashTableShape, Object*>;
+template class HashTable<ObjectHashTable, ObjectHashTableShape, Object*>;
-template class HashTable<WeakHashTableShape<2>, Object*>;
+template class HashTable<WeakHashTable, WeakHashTableShape<2>, Object*>;
-template class Dictionary<NameDictionaryShape, Name*>;
+template class Dictionary<NameDictionary, NameDictionaryShape, Name*>;
-template class Dictionary<SeededNumberDictionaryShape, uint32_t>;
+template class Dictionary<SeededNumberDictionary,
+ SeededNumberDictionaryShape,
+ uint32_t>;
-template class Dictionary<UnseededNumberDictionaryShape, uint32_t>;
+template class Dictionary<UnseededNumberDictionary,
+ UnseededNumberDictionaryShape,
+ uint32_t>;
-template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::
+template MaybeObject*
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
Allocate(Heap* heap, int at_least_space_for, PretenureFlag pretenure);
-template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
+template MaybeObject*
+Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape,
uint32_t>::
Allocate(Heap* heap, int at_least_space_for, PretenureFlag pretenure);
-template MaybeObject* Dictionary<NameDictionaryShape, Name*>::
+template MaybeObject* Dictionary<NameDictionary, NameDictionaryShape,
Name*>::
Allocate(Heap* heap, int n, PretenureFlag pretenure);
-template MaybeObject* Dictionary<SeededNumberDictionaryShape,
uint32_t>::AtPut(
- uint32_t, Object*);
+template MaybeObject*
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
+ AtPut(uint32_t, Object*);
-template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
+template MaybeObject*
+Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape,
uint32_t>::
AtPut(uint32_t, Object*);
-template Object* Dictionary<SeededNumberDictionaryShape, uint32_t>::
+template Object*
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
SlowReverseLookup(Object* value);
-template Object* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
+template Object*
+Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape,
uint32_t>::
SlowReverseLookup(Object* value);
-template Object* Dictionary<NameDictionaryShape, Name*>::SlowReverseLookup(
+template Object*
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::SlowReverseLookup(
Object*);
-template void Dictionary<SeededNumberDictionaryShape,
uint32_t>::CopyKeysTo(
- FixedArray*,
- PropertyAttributes,
- Dictionary<SeededNumberDictionaryShape, uint32_t>::SortMode);
+template void
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
+ CopyKeysTo(
+ FixedArray*,
+ PropertyAttributes,
+ Dictionary<SeededNumberDictionary,
+ SeededNumberDictionaryShape,
+ uint32_t>::SortMode);
-template Object* Dictionary<NameDictionaryShape, Name*>::DeleteProperty(
+template Object*
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
int, JSObject::DeleteMode);
-template Handle<Object> Dictionary<NameDictionaryShape,
Name*>::DeleteProperty(
- Handle<Dictionary<NameDictionaryShape, Name*> >,
+template Handle<Object>
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::DeleteProperty(
+ Handle<Dictionary<NameDictionary, NameDictionaryShape, Name*> >,
int,
JSObject::DeleteMode);
-template Object* Dictionary<SeededNumberDictionaryShape, uint32_t>::
+template Object*
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
DeleteProperty(int, JSObject::DeleteMode);
template Handle<Object>
-Dictionary<SeededNumberDictionaryShape, uint32_t>::DeleteProperty(
- Handle<Dictionary<SeededNumberDictionaryShape, uint32_t> >,
- int,
- JSObject::DeleteMode);
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
+ DeleteProperty(
+ Handle<Dictionary<SeededNumberDictionary,
+ SeededNumberDictionaryShape,
+ uint32_t> >,
+ int,
+ JSObject::DeleteMode);
-template MaybeObject* Dictionary<NameDictionaryShape, Name*>::Shrink(Name*
n);
+template Handle<NameDictionary>
+HashTable<NameDictionary, NameDictionaryShape, Name*>::
+ Shrink(Handle<NameDictionary>, Name* n);
-template MaybeObject* Dictionary<SeededNumberDictionaryShape,
uint32_t>::Shrink(
- uint32_t);
-template Handle<FixedArray>
-Dictionary<SeededNumberDictionaryShape, uint32_t>::Shrink(
- Handle<Dictionary<SeededNumberDictionaryShape, uint32_t> >,
- uint32_t);
+template Handle<SeededNumberDictionary>
+HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
+ Shrink(Handle<SeededNumberDictionary>, uint32_t);
-template void Dictionary<NameDictionaryShape, Name*>::CopyKeysTo(
- FixedArray*,
- int,
- PropertyAttributes,
- Dictionary<NameDictionaryShape, Name*>::SortMode);
+template void Dictionary<NameDictionary, NameDictionaryShape, Name*>::
+ CopyKeysTo(
+ FixedArray*,
+ int,
+ PropertyAttributes,
+ Dictionary<NameDictionary, NameDictionaryShape, Name*>::SortMode);
template int
-Dictionary<NameDictionaryShape, Name*>::NumberOfElementsFilterAttributes(
- PropertyAttributes);
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::
+ NumberOfElementsFilterAttributes(PropertyAttributes);
-template MaybeObject* Dictionary<NameDictionaryShape, Name*>::Add(
+template MaybeObject*
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::Add(
Name*, Object*, PropertyDetails);
template MaybeObject*
-Dictionary<NameDictionaryShape, Name*>::GenerateNewEnumerationIndices();
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::
+ GenerateNewEnumerationIndices();
template int
-Dictionary<SeededNumberDictionaryShape, uint32_t>::
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
NumberOfElementsFilterAttributes(PropertyAttributes);
-template MaybeObject* Dictionary<SeededNumberDictionaryShape,
uint32_t>::Add(
+template MaybeObject*
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape,
uint32_t>::Add(
uint32_t, Object*, PropertyDetails);
-template MaybeObject* Dictionary<UnseededNumberDictionaryShape,
uint32_t>::Add(
- uint32_t, Object*, PropertyDetails);
+template MaybeObject*
+Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape,
uint32_t>::
+ Add(uint32_t, Object*, PropertyDetails);
-template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::
+template MaybeObject*
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
EnsureCapacity(int, uint32_t);
-template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
+template MaybeObject*
+Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape,
uint32_t>::
EnsureCapacity(int, uint32_t);
-template MaybeObject* Dictionary<NameDictionaryShape, Name*>::
+template MaybeObject*
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::
EnsureCapacity(int, Name*);
-template MaybeObject* Dictionary<SeededNumberDictionaryShape, uint32_t>::
+template MaybeObject*
+Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
-template MaybeObject* Dictionary<UnseededNumberDictionaryShape, uint32_t>::
+template MaybeObject*
+Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape,
uint32_t>::
AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
-template MaybeObject* Dictionary<NameDictionaryShape, Name*>::AddEntry(
+template MaybeObject*
+Dictionary<NameDictionary, NameDictionaryShape, Name*>::AddEntry(
Name*, Object*, PropertyDetails, uint32_t);
template
-int Dictionary<SeededNumberDictionaryShape,
uint32_t>::NumberOfEnumElements();
+int Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape,
uint32_t>::
+ NumberOfEnumElements();
template
-int Dictionary<NameDictionaryShape, Name*>::NumberOfEnumElements();
+int Dictionary<NameDictionary, NameDictionaryShape, Name*>::
+ NumberOfEnumElements();
template
-int HashTable<SeededNumberDictionaryShape, uint32_t>::FindEntry(uint32_t);
+int HashTable<SeededNumberDictionary, SeededNumberDictionaryShape,
uint32_t>::
+ FindEntry(uint32_t);
Handle<Object> JSObject::PrepareSlowElementsForSort(
@@ -14913,6 +14958,7 @@
bool StringTable::LookupStringIfExists(String* string, String** result) {
+ SLOW_ASSERT(this == HeapObject::cast(this)->GetHeap()->string_table());
InternalizedStringKey key(string);
int entry = FindEntry(&key);
if (entry == kNotFound) {
@@ -14928,6 +14974,7 @@
bool StringTable::LookupTwoCharsStringIfExists(uint16_t c1,
uint16_t c2,
String** result) {
+ SLOW_ASSERT(this == HeapObject::cast(this)->GetHeap()->string_table());
TwoCharHashTableKey key(c1, c2, GetHeap()->HashSeed());
int entry = FindEntry(&key);
if (entry == kNotFound) {
@@ -14941,6 +14988,7 @@
MaybeObject* StringTable::LookupKey(HashTableKey* key, Object** s) {
+ SLOW_ASSERT(this == HeapObject::cast(this)->GetHeap()->string_table());
int entry = FindEntry(key);
// String already in table.
@@ -15142,13 +15190,14 @@
}
-template<typename Shape, typename Key>
-MaybeObject* Dictionary<Shape, Key>::Allocate(Heap* heap,
- int at_least_space_for,
- PretenureFlag pretenure) {
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* Dictionary<Derived, Shape, Key>::Allocate(
+ Heap* heap,
+ int at_least_space_for,
+ PretenureFlag pretenure) {
Object* obj;
{ MaybeObject* maybe_obj =
- HashTable<Shape, Key>::Allocate(
+ DerivedHashTable::Allocate(
heap,
at_least_space_for,
USE_DEFAULT_MINIMUM_CAPACITY,
@@ -15156,7 +15205,7 @@
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
}
// Initialize the next enumeration index.
- Dictionary<Shape, Key>::cast(obj)->
+ Dictionary::cast(obj)->
SetNextEnumerationIndex(PropertyDetails::kInitialIndex);
return obj;
}
@@ -15168,10 +15217,10 @@
dictionary->GenerateNewEnumerationIndices());
}
-template<typename Shape, typename Key>
-MaybeObject* Dictionary<Shape, Key>::GenerateNewEnumerationIndices() {
- Heap* heap = Dictionary<Shape, Key>::GetHeap();
- int length = HashTable<Shape, Key>::NumberOfElements();
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* Dictionary<Derived, Shape,
Key>::GenerateNewEnumerationIndices() {
+ Heap* heap = Dictionary::GetHeap();
+ int length = DerivedHashTable::NumberOfElements();
// Allocate and initialize iteration order array.
Object* obj;
@@ -15190,10 +15239,10 @@
FixedArray* enumeration_order = FixedArray::cast(obj);
// Fill the enumeration order array with property details.
- int capacity = HashTable<Shape, Key>::Capacity();
+ int capacity = DerivedHashTable::Capacity();
int pos = 0;
for (int i = 0; i < capacity; i++) {
- if (Dictionary<Shape, Key>::IsKey(Dictionary<Shape, Key>::KeyAt(i))) {
+ if (Dictionary::IsKey(Dictionary::KeyAt(i))) {
int index = DetailsAt(i).dictionary_index();
enumeration_order->set(pos++, Smi::FromInt(index));
}
@@ -15210,10 +15259,10 @@
}
// Update the dictionary with new indices.
- capacity = HashTable<Shape, Key>::Capacity();
+ capacity = DerivedHashTable::Capacity();
pos = 0;
for (int i = 0; i < capacity; i++) {
- if (Dictionary<Shape, Key>::IsKey(Dictionary<Shape, Key>::KeyAt(i))) {
+ if (Dictionary::IsKey(Dictionary::KeyAt(i))) {
int enum_index = Smi::cast(enumeration_order->get(pos++))->value();
PropertyDetails details = DetailsAt(i);
PropertyDetails new_details = PropertyDetails(
@@ -15227,8 +15276,8 @@
return this;
}
-template<typename Shape, typename Key>
-MaybeObject* Dictionary<Shape, Key>::EnsureCapacity(int n, Key key) {
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* Dictionary<Derived, Shape, Key>::EnsureCapacity(int n, Key
key) {
// Check whether there are enough enumeration indices to add n elements.
if (Shape::kIsEnumerable &&
!PropertyDetails::IsValidIndex(NextEnumerationIndex() + n)) {
@@ -15238,14 +15287,14 @@
if (!maybe_result->ToObject(&result)) return maybe_result;
}
}
- return HashTable<Shape, Key>::EnsureCapacity(n, key);
+ return DerivedHashTable::EnsureCapacity(n, key);
}
// TODO(ishell): Temporary wrapper until handlified.
-template<typename Shape, typename Key>
-Handle<Object> Dictionary<Shape, Key>::DeleteProperty(
- Handle<Dictionary<Shape, Key> > dictionary,
+template<typename Derived, typename Shape, typename Key>
+Handle<Object> Dictionary<Derived, Shape, Key>::DeleteProperty(
+ Handle<Dictionary<Derived, Shape, Key> > dictionary,
int entry,
JSObject::DeleteMode mode) {
CALL_HEAP_FUNCTION(dictionary->GetIsolate(),
@@ -15254,44 +15303,28 @@
}
-template<typename Shape, typename Key>
-Object* Dictionary<Shape, Key>::DeleteProperty(int entry,
- JSReceiver::DeleteMode
mode) {
- Heap* heap = Dictionary<Shape, Key>::GetHeap();
+template<typename Derived, typename Shape, typename Key>
+Object* Dictionary<Derived, Shape, Key>::DeleteProperty(
+ int entry,
+ JSReceiver::DeleteMode mode) {
+ Heap* heap = Dictionary::GetHeap();
PropertyDetails details = DetailsAt(entry);
// Ignore attributes if forcing a deletion.
if (details.IsDontDelete() && mode != JSReceiver::FORCE_DELETION) {
return heap->false_value();
}
SetEntry(entry, heap->the_hole_value(), heap->the_hole_value());
- HashTable<Shape, Key>::ElementRemoved();
+ DerivedHashTable::ElementRemoved();
return heap->true_value();
}
-// TODO(ishell): Temporary wrapper until handlified.
-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) {
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* Dictionary<Derived, Shape, Key>::AtPut(Key key, Object*
value) {
int entry = this->FindEntry(key);
// If the entry is present set the value;
- if (entry != Dictionary<Shape, Key>::kNotFound) {
+ if (entry != Dictionary::kNotFound) {
ValueAtPut(entry, value);
return this;
}
@@ -15308,41 +15341,43 @@
}
PropertyDetails details = PropertyDetails(NONE, NORMAL, 0);
- return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details,
- Dictionary<Shape, Key>::Hash(key));
+ return Dictionary::cast(obj)->AddEntry(
+ key, value, details, Dictionary::Hash(key));
}
-template<typename Shape, typename Key>
-MaybeObject* Dictionary<Shape, Key>::Add(Key key,
- Object* value,
- PropertyDetails details) {
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* Dictionary<Derived, Shape, Key>::Add(
+ Key key,
+ Object* value,
+ PropertyDetails details) {
// Valdate key is absent.
- SLOW_ASSERT((this->FindEntry(key) == Dictionary<Shape, Key>::kNotFound));
+ SLOW_ASSERT((this->FindEntry(key) == Dictionary::kNotFound));
// Check whether the dictionary should be extended.
Object* obj;
{ MaybeObject* maybe_obj = EnsureCapacity(1, key);
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
}
- return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details,
- Dictionary<Shape, Key>::Hash(key));
+ return Dictionary::cast(obj)->AddEntry(
+ key, value, details, Dictionary::Hash(key));
}
// Add a key, value pair to the dictionary.
-template<typename Shape, typename Key>
-MaybeObject* Dictionary<Shape, Key>::AddEntry(Key key,
- Object* value,
- PropertyDetails details,
- uint32_t hash) {
+template<typename Derived, typename Shape, typename Key>
+MaybeObject* Dictionary<Derived, Shape, Key>::AddEntry(
+ Key key,
+ Object* value,
+ PropertyDetails details,
+ uint32_t hash) {
// Compute the key object.
Object* k;
{ MaybeObject* maybe_k = Shape::AsObject(this->GetHeap(), key);
if (!maybe_k->ToObject(&k)) return maybe_k;
}
- uint32_t entry = Dictionary<Shape, Key>::FindInsertionEntry(hash);
+ uint32_t entry = Dictionary::FindInsertionEntry(hash);
// Insert element at empty or deleted entry
if (!details.IsDeleted() &&
details.dictionary_index() == 0 &&
@@ -15354,9 +15389,9 @@
SetNextEnumerationIndex(index + 1);
}
SetEntry(entry, k, value, details);
- ASSERT((Dictionary<Shape, Key>::KeyAt(entry)->IsNumber() ||
- Dictionary<Shape, Key>::KeyAt(entry)->IsName()));
- HashTable<Shape, Key>::ElementAdded();
+ ASSERT((Dictionary::KeyAt(entry)->IsNumber() ||
+ Dictionary::KeyAt(entry)->IsName()));
+ DerivedHashTable::ElementAdded();
return this;
}
@@ -15470,14 +15505,14 @@
-template<typename Shape, typename Key>
-int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes(
+template<typename Derived, typename Shape, typename Key>
+int Dictionary<Derived, Shape, Key>::NumberOfElementsFilterAttributes(
PropertyAttributes filter) {
- int capacity = HashTable<Shape, Key>::Capacity();
+ int capacity = DerivedHashTable::Capacity();
int result = 0;
for (int i = 0; i < capacity; i++) {
- Object* k = HashTable<Shape, Key>::KeyAt(i);
- if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
+ Object* k = DerivedHashTable::KeyAt(i);
+ if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
PropertyDetails details = DetailsAt(i);
if (details.IsDeleted()) continue;
PropertyAttributes attr = details.attributes();
@@ -15488,31 +15523,31 @@
}
-template<typename Shape, typename Key>
-int Dictionary<Shape, Key>::NumberOfEnumElements() {
+template<typename Derived, typename Shape, typename Key>
+int Dictionary<Derived, Shape, Key>::NumberOfEnumElements() {
return NumberOfElementsFilterAttributes(
static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC));
}
-template<typename Shape, typename Key>
-void Dictionary<Shape, Key>::CopyKeysTo(
+template<typename Derived, typename Shape, typename Key>
+void Dictionary<Derived, Shape, Key>::CopyKeysTo(
FixedArray* storage,
PropertyAttributes filter,
- typename Dictionary<Shape, Key>::SortMode sort_mode) {
+ typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) {
ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
- int capacity = HashTable<Shape, Key>::Capacity();
+ int capacity = DerivedHashTable::Capacity();
int index = 0;
for (int i = 0; i < capacity; i++) {
- Object* k = HashTable<Shape, Key>::KeyAt(i);
- if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
+ Object* k = DerivedHashTable::KeyAt(i);
+ if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
PropertyDetails details = DetailsAt(i);
if (details.IsDeleted()) continue;
PropertyAttributes attr = details.attributes();
if ((attr & filter) == 0) storage->set(index++, k);
}
}
- if (sort_mode == Dictionary<Shape, Key>::SORTED) {
+ if (sort_mode == Dictionary::SORTED) {
storage->SortPairs(storage, index);
}
ASSERT(storage->length() >= index);
@@ -15554,24 +15589,24 @@
}
-template<typename Shape, typename Key>
-void Dictionary<Shape, Key>::CopyKeysTo(
+template<typename Derived, typename Shape, typename Key>
+void Dictionary<Derived, Shape, Key>::CopyKeysTo(
FixedArray* storage,
int index,
PropertyAttributes filter,
- typename Dictionary<Shape, Key>::SortMode sort_mode) {
+ typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) {
ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
- int capacity = HashTable<Shape, Key>::Capacity();
+ int capacity = DerivedHashTable::Capacity();
for (int i = 0; i < capacity; i++) {
- Object* k = HashTable<Shape, Key>::KeyAt(i);
- if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
+ Object* k = DerivedHashTable::KeyAt(i);
+ if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
PropertyDetails details = DetailsAt(i);
if (details.IsDeleted()) continue;
PropertyAttributes attr = details.attributes();
if ((attr & filter) == 0) storage->set(index++, k);
}
}
- if (sort_mode == Dictionary<Shape, Key>::SORTED) {
+ if (sort_mode == Dictionary::SORTED) {
storage->SortPairs(storage, index);
}
ASSERT(storage->length() >= index);
@@ -15579,12 +15614,12 @@
// Backwards lookup (slow).
-template<typename Shape, typename Key>
-Object* Dictionary<Shape, Key>::SlowReverseLookup(Object* value) {
- int capacity = HashTable<Shape, Key>::Capacity();
+template<typename Derived, typename Shape, typename Key>
+Object* Dictionary<Derived, Shape, Key>::SlowReverseLookup(Object* value) {
+ int capacity = DerivedHashTable::Capacity();
for (int i = 0; i < capacity; i++) {
- Object* k = HashTable<Shape, Key>::KeyAt(i);
- if (Dictionary<Shape, Key>::IsKey(k)) {
+ Object* k = DerivedHashTable::KeyAt(i);
+ if (Dictionary::IsKey(k)) {
Object* e = ValueAt(i);
if (e->IsPropertyCell()) {
e = PropertyCell::cast(e)->value();
@@ -15592,7 +15627,7 @@
if (e == value) return k;
}
}
- Heap* heap = Dictionary<Shape, Key>::GetHeap();
+ Heap* heap = Dictionary::GetHeap();
return heap->undefined_value();
}
@@ -15602,20 +15637,13 @@
int n,
Handle<Object> key,
PretenureFlag pretenure) {
- Handle<HashTable<ObjectHashTableShape, Object*> > table_base = table;
+ Handle<HashTable<ObjectHashTable,
+ ObjectHashTableShape,
+ Object*> > table_base = table;
CALL_HEAP_FUNCTION(table_base->GetIsolate(),
table_base->EnsureCapacity(n, *key, pretenure),
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) {
=======================================
--- /branches/bleeding_edge/src/objects.h Mon Apr 14 13:25:16 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Mon Apr 14 15:56:57 2014 UTC
@@ -3656,7 +3656,7 @@
}
};
-template<typename Shape, typename Key>
+template<typename Derived, typename Shape, typename Key>
class HashTable: public FixedArray {
public:
// Wrapper methods
@@ -3709,12 +3709,20 @@
}
// Returns a new HashTable object. Might return Failure.
+ // TODO(ishell): this will be eventually replaced by New().
MUST_USE_RESULT static MaybeObject* Allocate(
Heap* heap,
int at_least_space_for,
MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY,
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
// number of elements. May be more than HashTable::kMaxCapacity.
static int ComputeCapacity(int at_least_space_for);
@@ -3824,10 +3832,10 @@
void Swap(uint32_t entry1, uint32_t entry2, WriteBarrierMode mode);
// Rehashes this hash-table into the new table.
- MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key);
+ void Rehash(Derived* new_table, Key key);
// Attempt to shrink hash table after removal of key.
- MUST_USE_RESULT MaybeObject* Shrink(Key key);
+ static Handle<Derived> Shrink(Handle<Derived> table, Key key);
// Ensure enough space for n additional elements.
MUST_USE_RESULT MaybeObject* EnsureCapacity(
@@ -3880,7 +3888,11 @@
//
// No special elements in the prefix and the element size is 1
// because only the string itself (the key) needs to be stored.
-class StringTable: public HashTable<StringTableShape, HashTableKey*> {
+// TODO(ishell): Make StringTable a singleton class and move
+// Heap::InternalizeStringXX() methods here.
+class StringTable: public HashTable<StringTable,
+ StringTableShape,
+ HashTableKey*> {
public:
// 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
@@ -3932,7 +3944,7 @@
//
// Maps keys that are a fixed array of unique names to a map.
// Used for canonicalize maps for object literals.
-class MapCache: public HashTable<MapCacheShape, HashTableKey*> {
+class MapCache: public HashTable<MapCache, MapCacheShape, HashTableKey*> {
public:
// Find cached value for a name key, otherwise return null.
Object* Lookup(FixedArray* key);
@@ -3944,33 +3956,36 @@
};
-template <typename Shape, typename Key>
-class Dictionary: public HashTable<Shape, Key> {
+template <typename Derived, typename Shape, typename Key>
+class Dictionary: public HashTable<Derived, Shape, Key> {
+ protected:
+ typedef HashTable<Derived, Shape, Key> DerivedHashTable;
+
public:
- static inline Dictionary<Shape, Key>* cast(Object* obj) {
- return reinterpret_cast<Dictionary<Shape, Key>*>(obj);
+ static inline Dictionary* cast(Object* obj) {
+ return reinterpret_cast<Dictionary*>(obj);
}
// Returns the value at entry.
Object* ValueAt(int entry) {
- return this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 1);
+ return this->get(DerivedHashTable::EntryToIndex(entry) + 1);
}
// Set the value for entry.
void ValueAtPut(int entry, Object* value) {
- this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 1, value);
+ this->set(DerivedHashTable::EntryToIndex(entry) + 1, value);
}
// Returns the property details for the property at entry.
PropertyDetails DetailsAt(int entry) {
ASSERT(entry >= 0); // Not found is -1, which is not caught by get().
return PropertyDetails(
- Smi::cast(this->get(HashTable<Shape, Key>::EntryToIndex(entry) +
2)));
+ Smi::cast(this->get(DerivedHashTable::EntryToIndex(entry) + 2)));
}
// Set the details for entry.
void DetailsAtPut(int entry, PropertyDetails value) {
- this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 2,
value.AsSmi());
+ this->set(DerivedHashTable::EntryToIndex(entry) + 2, value.AsSmi());
}
// Sorting support
@@ -3980,16 +3995,14 @@
Object* DeleteProperty(int entry, JSObject::DeleteMode mode);
// TODO(ishell): Temporary wrapper until handlified.
static Handle<Object> DeleteProperty(
- Handle<Dictionary<Shape, Key> > dictionary,
+ Handle<Dictionary> dictionary,
int entry,
JSObject::DeleteMode mode);
// Attempt to shrink the dictionary after deletion of key.
- MUST_USE_RESULT MaybeObject* Shrink(Key key);
- // TODO(ishell): Temporary wrapper until handlified.
- MUST_USE_RESULT static Handle<FixedArray> Shrink(
- Handle<Dictionary<Shape, Key> > dictionary,
- Key key);
+ static inline Handle<Derived> Shrink(Handle<Derived> dictionary, Key
key) {
+ return DerivedHashTable::Shrink(dictionary, key);
+ }
// Returns the number of elements in the dictionary filtering out
properties
// with the specified attributes.
@@ -4059,8 +4072,7 @@
// Generate new enumeration indices to avoid enumeration index overflow.
MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices();
- static const int kMaxNumberKeyIndex =
- HashTable<Shape, Key>::kPrefixStartIndex;
+ static const int kMaxNumberKeyIndex =
DerivedHashTable::kPrefixStartIndex;
static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
};
@@ -4078,7 +4090,9 @@
};
-class NameDictionary: public Dictionary<NameDictionaryShape, Name*> {
+class NameDictionary: public Dictionary<NameDictionary,
+ NameDictionaryShape,
+ Name*> {
public:
static inline NameDictionary* cast(Object* obj) {
ASSERT(obj->IsDictionary());
@@ -4128,7 +4142,9 @@
class SeededNumberDictionary
- : public Dictionary<SeededNumberDictionaryShape, uint32_t> {
+ : public Dictionary<SeededNumberDictionary,
+ SeededNumberDictionaryShape,
+ uint32_t> {
public:
static SeededNumberDictionary* cast(Object* obj) {
ASSERT(obj->IsDictionary());
@@ -4181,7 +4197,9 @@
class UnseededNumberDictionary
- : public Dictionary<UnseededNumberDictionaryShape, uint32_t> {
+ : public Dictionary<UnseededNumberDictionary,
+ UnseededNumberDictionaryShape,
+ uint32_t> {
public:
static UnseededNumberDictionary* cast(Object* obj) {
ASSERT(obj->IsDictionary());
@@ -4217,7 +4235,10 @@
// ObjectHashTable maps keys that are arbitrary objects to object values by
// using the identity hash of the key for hashing purposes.
-class ObjectHashTable: public HashTable<ObjectHashTableShape, Object*> {
+class ObjectHashTable: public HashTable<ObjectHashTable,
+ ObjectHashTableShape,
+ Object*> {
+ typedef HashTable<ObjectHashTable, ObjectHashTableShape, Object*>
HashTable_;
public:
static inline ObjectHashTable* cast(Object* obj) {
ASSERT(obj->IsHashTable());
@@ -4231,8 +4252,8 @@
PretenureFlag pretenure = NOT_TENURED);
// Attempt to shrink hash table after removal of key.
- static Handle<ObjectHashTable> Shrink(Handle<ObjectHashTable> table,
- Handle<Object> key);
+ static inline Handle<ObjectHashTable> Shrink(Handle<ObjectHashTable>
table,
+ Handle<Object> key);
// Looks up the value associated with the given key. The hole value is
// returned in case the key is not present.
@@ -4430,7 +4451,9 @@
// WeakHashTable maps keys that are arbitrary objects to object values.
// It is used for the global weak hash table that maps objects
// embedded in optimized code to dependent code lists.
-class WeakHashTable: public HashTable<WeakHashTableShape<2>, Object*> {
+class WeakHashTable: public HashTable<WeakHashTable,
+ WeakHashTableShape<2>,
+ Object*> {
public:
static inline WeakHashTable* cast(Object* obj) {
ASSERT(obj->IsHashTable());
@@ -8200,7 +8223,8 @@
};
-class CompilationCacheTable: public HashTable<CompilationCacheShape,
+class CompilationCacheTable: public HashTable<CompilationCacheTable,
+ CompilationCacheShape,
HashTableKey*> {
public:
// Find cached value for a string key, otherwise return null.
@@ -8301,7 +8325,8 @@
};
-class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape,
+class CodeCacheHashTable: public HashTable<CodeCacheHashTable,
+ CodeCacheHashTableShape,
HashTableKey*> {
public:
Object* Lookup(Name* name, Code::Flags flags);
@@ -8351,7 +8376,9 @@
class PolymorphicCodeCacheHashTable
- : public HashTable<CodeCacheHashTableShape, HashTableKey*> {
+ : public HashTable<PolymorphicCodeCacheHashTable,
+ CodeCacheHashTableShape,
+ HashTableKey*> {
public:
Object* Lookup(MapHandleList* maps, int code_kind);
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.