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

Unified Diff: src/heap.cc

Issue 9269004: Fix keyed lookup cache to have 2 entried per bucket instead (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 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/heap.h ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 10448)
+++ src/heap.cc (working copy)
@@ -6515,11 +6515,17 @@
int KeyedLookupCache::Lookup(Map* map, String* name) {
- int index = Hash(map, name);
+ int index = (Hash(map, name) & kHashMask);
Key& key = keys_[index];
if ((key.map == map) && key.name->Equals(name)) {
return field_offsets_[index];
}
+ ASSERT(kEntriesPerBucket == 2); // There are two entries to check.
+ // First entry in the bucket missed, check the second.
+ Key& key2 = keys_[index + 1];
+ if ((key2.map == map) && key2.name->Equals(name)) {
+ return field_offsets_[index + 1];
+ }
return kNotFound;
}
@@ -6527,8 +6533,14 @@
void KeyedLookupCache::Update(Map* map, String* name, int field_offset) {
String* symbol;
if (HEAP->LookupSymbolIfExists(name, &symbol)) {
- int index = Hash(map, symbol);
+ int index = (Hash(map, symbol) & kHashMask);
Key& key = keys_[index];
+ Key& key2 = keys_[index + 1]; // Second entry in the bucket.
+ // Demote the first entry to the second in the bucket.
+ key2.map = key.map;
+ key2.name = key.name;
+ field_offsets_[index + 1] = field_offsets_[index];
+ // Write the new first entry.
key.map = map;
key.name = symbol;
field_offsets_[index] = field_offset;
« no previous file with comments | « src/heap.h ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698