OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 14193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14204 template class HashTable<StringTable, StringTableShape, HashTableKey*>; | 14204 template class HashTable<StringTable, StringTableShape, HashTableKey*>; |
14205 | 14205 |
14206 template class HashTable<CompilationCacheTable, | 14206 template class HashTable<CompilationCacheTable, |
14207 CompilationCacheShape, | 14207 CompilationCacheShape, |
14208 HashTableKey*>; | 14208 HashTableKey*>; |
14209 | 14209 |
14210 template class HashTable<ObjectHashTable, | 14210 template class HashTable<ObjectHashTable, |
14211 ObjectHashTableShape, | 14211 ObjectHashTableShape, |
14212 Handle<Object> >; | 14212 Handle<Object> >; |
14213 | 14213 |
14214 template class HashTable<WeakHashTable, WeakHashTableShape<2>, Handle<Object> >; | 14214 template class HashTable<WeakHashTable, HeapPointerShape<2>, Handle<Object> >; |
| 14215 |
| 14216 template class HashTable<EmbeddedMapCache, HeapPointerShape<2>, |
| 14217 Handle<Object> >; |
14215 | 14218 |
14216 template class Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >; | 14219 template class Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >; |
14217 | 14220 |
14218 template class Dictionary<SeededNumberDictionary, | 14221 template class Dictionary<SeededNumberDictionary, |
14219 SeededNumberDictionaryShape, | 14222 SeededNumberDictionaryShape, |
14220 uint32_t>; | 14223 uint32_t>; |
14221 | 14224 |
14222 template class Dictionary<UnseededNumberDictionary, | 14225 template class Dictionary<UnseededNumberDictionary, |
14223 UnseededNumberDictionaryShape, | 14226 UnseededNumberDictionaryShape, |
14224 uint32_t>; | 14227 uint32_t>; |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15683 DisallowHeapAllocation no_allocation; | 15686 DisallowHeapAllocation no_allocation; |
15684 // TODO(ulan): Skipping write barrier is a temporary solution to avoid | 15687 // TODO(ulan): Skipping write barrier is a temporary solution to avoid |
15685 // memory leaks. Remove this once we have special visitor for weak fixed | 15688 // memory leaks. Remove this once we have special visitor for weak fixed |
15686 // arrays. | 15689 // arrays. |
15687 set(EntryToIndex(entry), *key, SKIP_WRITE_BARRIER); | 15690 set(EntryToIndex(entry), *key, SKIP_WRITE_BARRIER); |
15688 set(EntryToValueIndex(entry), *value, SKIP_WRITE_BARRIER); | 15691 set(EntryToValueIndex(entry), *value, SKIP_WRITE_BARRIER); |
15689 ElementAdded(); | 15692 ElementAdded(); |
15690 } | 15693 } |
15691 | 15694 |
15692 | 15695 |
| 15696 Handle<EmbeddedMapCache> EmbeddedMapCache::Put(Handle<EmbeddedMapCache> table, |
| 15697 Handle<Map> key) { |
| 15698 DCHECK(table->IsKey(*key)); |
| 15699 int entry = table->FindEntry(key); |
| 15700 // Key is already in table, just overwrite value. |
| 15701 if (entry != kNotFound) { |
| 15702 table->set(EntryToValueIndex(entry), Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 15703 return table; |
| 15704 } |
| 15705 |
| 15706 // Check whether the hash table should be extended. |
| 15707 table = EnsureCapacity(table, 1, key, TENURED); |
| 15708 DisallowHeapAllocation no_allocation; |
| 15709 entry = table->FindInsertionEntry(table->Hash(key)); |
| 15710 table->set(EntryToIndex(entry), *key); |
| 15711 table->set(EntryToValueIndex(entry), Smi::FromInt(0), SKIP_WRITE_BARRIER); |
| 15712 table->ElementAdded(); |
| 15713 return table; |
| 15714 } |
| 15715 |
| 15716 |
| 15717 void EmbeddedMapCache::Age() { |
| 15718 int capacity = Capacity(); |
| 15719 for (int i = 0; i < capacity; i++) { |
| 15720 Object* value = get(EntryToValueIndex(i)); |
| 15721 if (value->IsSmi()) { |
| 15722 int age = Smi::cast(value)->value(); |
| 15723 if (age > kMaxAge) { |
| 15724 set_the_hole(EntryToIndex(i)); |
| 15725 set_the_hole(EntryToIndex(i) + 1); |
| 15726 ElementRemoved(); |
| 15727 } else { |
| 15728 set(EntryToValueIndex(i), Smi::FromInt(age + 1), SKIP_WRITE_BARRIER); |
| 15729 } |
| 15730 } |
| 15731 } |
| 15732 } |
| 15733 |
| 15734 |
15693 template<class Derived, class Iterator, int entrysize> | 15735 template<class Derived, class Iterator, int entrysize> |
15694 Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Allocate( | 15736 Handle<Derived> OrderedHashTable<Derived, Iterator, entrysize>::Allocate( |
15695 Isolate* isolate, int capacity, PretenureFlag pretenure) { | 15737 Isolate* isolate, int capacity, PretenureFlag pretenure) { |
15696 // Capacity must be a power of two, since we depend on being able | 15738 // Capacity must be a power of two, since we depend on being able |
15697 // to divide and multiple by 2 (kLoadFactor) to derive capacity | 15739 // to divide and multiple by 2 (kLoadFactor) to derive capacity |
15698 // from number of buckets. If we decide to change kLoadFactor | 15740 // from number of buckets. If we decide to change kLoadFactor |
15699 // to something other than 2, capacity should be stored as another | 15741 // to something other than 2, capacity should be stored as another |
15700 // field of this object. | 15742 // field of this object. |
15701 capacity = base::bits::RoundUpToPowerOfTwo32(Max(kMinCapacity, capacity)); | 15743 capacity = base::bits::RoundUpToPowerOfTwo32(Max(kMinCapacity, capacity)); |
15702 if (capacity > kMaxCapacity) { | 15744 if (capacity > kMaxCapacity) { |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16664 Handle<DependentCode> codes = | 16706 Handle<DependentCode> codes = |
16665 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16707 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16666 DependentCode::kPropertyCellChangedGroup, | 16708 DependentCode::kPropertyCellChangedGroup, |
16667 info->object_wrapper()); | 16709 info->object_wrapper()); |
16668 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16710 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16669 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16711 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16670 cell, info->zone()); | 16712 cell, info->zone()); |
16671 } | 16713 } |
16672 | 16714 |
16673 } } // namespace v8::internal | 16715 } } // namespace v8::internal |
OLD | NEW |