Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: src/objects.cc

Issue 712943002: MapCache simplification. It is now a FixedArray that maps number of properties to a WeakCell with... (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14189 matching lines...) Expand 10 before | Expand all | Expand 10 after
14200 14200
14201 // Force instantiation of template instances class. 14201 // Force instantiation of template instances class.
14202 // Please note this list is compiler dependent. 14202 // Please note this list is compiler dependent.
14203 14203
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<MapCache, MapCacheShape, HashTableKey*>;
14211
14212 template class HashTable<ObjectHashTable, 14210 template class HashTable<ObjectHashTable,
14213 ObjectHashTableShape, 14211 ObjectHashTableShape,
14214 Handle<Object> >; 14212 Handle<Object> >;
14215 14213
14216 template class HashTable<WeakHashTable, WeakHashTableShape<2>, Handle<Object> >; 14214 template class HashTable<WeakHashTable, WeakHashTableShape<2>, Handle<Object> >;
14217 14215
14218 template class Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >; 14216 template class Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >;
14219 14217
14220 template class Dictionary<SeededNumberDictionary, 14218 template class Dictionary<SeededNumberDictionary,
14221 SeededNumberDictionaryShape, 14219 SeededNumberDictionaryShape,
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
15151 return hash; 15149 return hash;
15152 } 15150 }
15153 15151
15154 Handle<Object> AsHandle(Isolate* isolate) OVERRIDE { return strings_; } 15152 Handle<Object> AsHandle(Isolate* isolate) OVERRIDE { return strings_; }
15155 15153
15156 private: 15154 private:
15157 Handle<FixedArray> strings_; 15155 Handle<FixedArray> strings_;
15158 }; 15156 };
15159 15157
15160 15158
15161 Object* MapCache::Lookup(FixedArray* array) {
15162 DisallowHeapAllocation no_alloc;
15163 StringsKey key(handle(array));
15164 int entry = FindEntry(&key);
15165 if (entry == kNotFound) return GetHeap()->undefined_value();
15166 return get(EntryToIndex(entry) + 1);
15167 }
15168
15169
15170 Handle<MapCache> MapCache::Put(
15171 Handle<MapCache> map_cache, Handle<FixedArray> array, Handle<Map> value) {
15172 StringsKey key(array);
15173
15174 Handle<MapCache> new_cache = EnsureCapacity(map_cache, 1, &key);
15175 int entry = new_cache->FindInsertionEntry(key.Hash());
15176 new_cache->set(EntryToIndex(entry), *array);
15177 new_cache->set(EntryToIndex(entry) + 1, *value);
15178 new_cache->ElementAdded();
15179 return new_cache;
15180 }
15181
15182
15183 template<typename Derived, typename Shape, typename Key> 15159 template<typename Derived, typename Shape, typename Key>
15184 Handle<Derived> Dictionary<Derived, Shape, Key>::New( 15160 Handle<Derived> Dictionary<Derived, Shape, Key>::New(
15185 Isolate* isolate, 15161 Isolate* isolate,
15186 int at_least_space_for, 15162 int at_least_space_for,
15187 PretenureFlag pretenure) { 15163 PretenureFlag pretenure) {
15188 DCHECK(0 <= at_least_space_for); 15164 DCHECK(0 <= at_least_space_for);
15189 Handle<Derived> dict = DerivedHashTable::New(isolate, 15165 Handle<Derived> dict = DerivedHashTable::New(isolate,
15190 at_least_space_for, 15166 at_least_space_for,
15191 USE_DEFAULT_MINIMUM_CAPACITY, 15167 USE_DEFAULT_MINIMUM_CAPACITY,
15192 pretenure); 15168 pretenure);
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
16688 Handle<DependentCode> codes = 16664 Handle<DependentCode> codes =
16689 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16665 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16690 DependentCode::kPropertyCellChangedGroup, 16666 DependentCode::kPropertyCellChangedGroup,
16691 info->object_wrapper()); 16667 info->object_wrapper());
16692 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16668 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16693 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16669 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16694 cell, info->zone()); 16670 cell, info->zone());
16695 } 16671 }
16696 16672
16697 } } // namespace v8::internal 16673 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698