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

Unified Diff: src/lookup.cc

Issue 2316503004: KeyedLookupCache and DescriptorLookupCache -> lookup-cache{-inl.h,.cc,.h} (Closed)
Patch Set: Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lookup.h ('k') | src/lookup-cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 75c7880b9ebbfa50cc31b6609d372d94ca73ee12..3921e1657c8511b5de5a1d96b6f802ae1649bbf0 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -13,77 +13,6 @@
namespace v8 {
namespace internal {
-void DescriptorLookupCache::Clear() {
- for (int index = 0; index < kLength; index++) keys_[index].source = NULL;
-}
-
-int KeyedLookupCache::Hash(Handle<Map> map, Handle<Name> name) {
- DisallowHeapAllocation no_gc;
- // Uses only lower 32 bits if pointers are larger.
- uintptr_t addr_hash =
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(*map)) >> kMapHashShift;
- return static_cast<uint32_t>((addr_hash ^ name->Hash()) & kCapacityMask);
-}
-
-int KeyedLookupCache::Lookup(Handle<Map> map, Handle<Name> name) {
- DisallowHeapAllocation no_gc;
- int index = (Hash(map, name) & kHashMask);
- for (int i = 0; i < kEntriesPerBucket; i++) {
- Key& key = keys_[index + i];
- if ((key.map == *map) && key.name->Equals(*name)) {
- return field_offsets_[index + i];
- }
- }
- return kNotFound;
-}
-
-void KeyedLookupCache::Update(Handle<Map> map, Handle<Name> name,
- int field_offset) {
- DisallowHeapAllocation no_gc;
- if (!name->IsUniqueName()) {
- if (!StringTable::InternalizeStringIfExists(name->GetIsolate(),
- Handle<String>::cast(name))
- .ToHandle(&name)) {
- return;
- }
- }
- // This cache is cleared only between mark compact passes, so we expect the
- // cache to only contain old space names.
- DCHECK(!map->GetIsolate()->heap()->InNewSpace(*name));
-
- int index = (Hash(map, name) & kHashMask);
- // After a GC there will be free slots, so we use them in order (this may
- // help to get the most frequently used one in position 0).
- for (int i = 0; i < kEntriesPerBucket; i++) {
- Key& key = keys_[index];
- Object* free_entry_indicator = NULL;
- if (key.map == free_entry_indicator) {
- key.map = *map;
- key.name = *name;
- field_offsets_[index + i] = field_offset;
- return;
- }
- }
- // No free entry found in this bucket, so we move them all down one and
- // put the new entry at position zero.
- for (int i = kEntriesPerBucket - 1; i > 0; i--) {
- Key& key = keys_[index + i];
- Key& key2 = keys_[index + i - 1];
- key = key2;
- field_offsets_[index + i] = field_offsets_[index + i - 1];
- }
-
- // Write the new first entry.
- Key& key = keys_[index];
- key.map = *map;
- key.name = *name;
- field_offsets_[index] = field_offset;
-}
-
-void KeyedLookupCache::Clear() {
- for (int index = 0; index < kLength; index++) keys_[index].map = NULL;
-}
-
// static
LookupIterator LookupIterator::PropertyOrElement(Isolate* isolate,
Handle<Object> receiver,
« no previous file with comments | « src/lookup.h ('k') | src/lookup-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698