Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index ab13412f52989ecc7eb9e6510ab6d46afe0a9e73..4754c8afae2b5ff492ed1349f2054982c4dc6159 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -14211,7 +14211,10 @@ template class HashTable<ObjectHashTable, |
ObjectHashTableShape, |
Handle<Object> >; |
-template class HashTable<WeakHashTable, WeakHashTableShape<2>, Handle<Object> >; |
+template class HashTable<WeakHashTable, HeapPointerShape<2>, Handle<Object> >; |
+ |
+template class HashTable<EmbeddedMapCache, HeapPointerShape<2>, |
+ Handle<Object> >; |
template class Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >; |
@@ -15690,6 +15693,45 @@ void WeakHashTable::AddEntry(int entry, |
} |
+Handle<EmbeddedMapCache> EmbeddedMapCache::Put(Handle<EmbeddedMapCache> table, |
+ Handle<Map> key) { |
+ DCHECK(table->IsKey(*key)); |
+ int entry = table->FindEntry(key); |
+ // Key is already in table, just overwrite value. |
+ if (entry != kNotFound) { |
+ table->set(EntryToValueIndex(entry), Smi::FromInt(0), SKIP_WRITE_BARRIER); |
+ return table; |
+ } |
+ |
+ // Check whether the hash table should be extended. |
+ table = EnsureCapacity(table, 1, key, TENURED); |
+ DisallowHeapAllocation no_allocation; |
+ entry = table->FindInsertionEntry(table->Hash(key)); |
+ table->set(EntryToIndex(entry), *key); |
+ table->set(EntryToValueIndex(entry), Smi::FromInt(0), SKIP_WRITE_BARRIER); |
+ table->ElementAdded(); |
+ return table; |
+} |
+ |
+ |
+void EmbeddedMapCache::Age() { |
+ int capacity = Capacity(); |
+ for (int i = 0; i < capacity; i++) { |
+ Object* value = get(EntryToValueIndex(i)); |
+ if (value->IsSmi()) { |
+ int age = Smi::cast(value)->value(); |
+ if (age > kMaxAge) { |
+ set_the_hole(EntryToIndex(i)); |
+ set_the_hole(EntryToIndex(i) + 1); |
+ ElementRemoved(); |
+ } else { |
+ set(EntryToValueIndex(i), Smi::FromInt(age + 1), SKIP_WRITE_BARRIER); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
template<class Derived, class Iterator, int entrysize> |
Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Allocate( |
Isolate* isolate, int capacity, PretenureFlag pretenure) { |