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

Unified Diff: src/ic/stub-cache.h

Issue 2147433002: [ic] [stubs] Don't use Code::flags in megamorphic stub cache hash computations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@split-stub-cache
Patch Set: Improved stub cache tests and the fixes. Created 4 years, 5 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/ic/s390/stub-cache-s390.cc ('k') | src/ic/stub-cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/stub-cache.h
diff --git a/src/ic/stub-cache.h b/src/ic/stub-cache.h
index b636aacc76566bfc1a36ec22119047368c5e6279..c3ab5dff2826b61baebccd8cf888890527b15848 100644
--- a/src/ic/stub-cache.h
+++ b/src/ic/stub-cache.h
@@ -41,13 +41,12 @@ class StubCache {
void Initialize();
// Access cache for entry hash(name, map).
Code* Set(Name* name, Map* map, Code* code);
- Code* Get(Name* name, Map* map, Code::Flags flags);
+ Code* Get(Name* name, Map* map);
// Clear the lookup table (@ mark compact collection).
void Clear();
- // Collect all maps that match the name and flags.
+ // Collect all maps that match the name.
void CollectMatchingMaps(SmallMapList* types, Handle<Name> name,
- Code::Flags flags, Handle<Context> native_context,
- Zone* zone);
+ Handle<Context> native_context, Zone* zone);
// Generate code for probing the stub cache table.
// Arguments extra, extra2 and extra3 may be used to pass additional scratch
// registers. Set to no_reg if not needed.
@@ -96,14 +95,15 @@ class StubCache {
static const int kPrimaryTableSize = (1 << kPrimaryTableBits);
static const int kSecondaryTableBits = 9;
static const int kSecondaryTableSize = (1 << kSecondaryTableBits);
+ // Some magic number used in secondary hash computations.
+ static const int kSecondaryMagic = 2;
- static int PrimaryOffsetForTesting(Name* name, Code::Flags flags, Map* map) {
- return PrimaryOffset(name, flags, map);
+ static int PrimaryOffsetForTesting(Name* name, Map* map) {
+ return PrimaryOffset(name, map);
}
- static int SecondaryOffsetForTesting(Name* name, Code::Flags flags,
- int seed) {
- return SecondaryOffset(name, flags, seed);
+ static int SecondaryOffsetForTesting(Name* name, int seed) {
+ return SecondaryOffset(name, seed);
}
// The constructor is made public only for the purposes of testing.
@@ -120,7 +120,7 @@ class StubCache {
// Hash algorithm for the primary table. This algorithm is replicated in
// assembler for every architecture. Returns an index into the table that
// is scaled by 1 << kCacheIndexShift.
- static int PrimaryOffset(Name* name, Code::Flags flags, Map* map) {
+ static int PrimaryOffset(Name* name, Map* map) {
STATIC_ASSERT(kCacheIndexShift == Name::kHashShift);
// Compute the hash of the name (use entire hash field).
DCHECK(name->HasHashCode());
@@ -130,27 +130,19 @@ class StubCache {
// 4Gb (and not at all if it isn't).
uint32_t map_low32bits =
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map));
- // We always set the in_loop bit to zero when generating the lookup code
- // so do it here too so the hash codes match.
- uint32_t iflags =
- (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup);
- // Base the offset on a simple combination of name, flags, and map.
- uint32_t key = (map_low32bits + field) ^ iflags;
+ // Base the offset on a simple combination of name and map.
+ uint32_t key = map_low32bits + field;
return key & ((kPrimaryTableSize - 1) << kCacheIndexShift);
}
// Hash algorithm for the secondary table. This algorithm is replicated in
// assembler for every architecture. Returns an index into the table that
// is scaled by 1 << kCacheIndexShift.
- static int SecondaryOffset(Name* name, Code::Flags flags, int seed) {
+ static int SecondaryOffset(Name* name, int seed) {
// Use the seed from the primary cache in the secondary cache.
uint32_t name_low32bits =
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name));
- // We always set the in_loop bit to zero when generating the lookup code
- // so do it here too so the hash codes match.
- uint32_t iflags =
- (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup);
- uint32_t key = (seed - name_low32bits) + iflags;
+ uint32_t key = (seed - name_low32bits) + kSecondaryMagic;
return key & ((kSecondaryTableSize - 1) << kCacheIndexShift);
}
« no previous file with comments | « src/ic/s390/stub-cache-s390.cc ('k') | src/ic/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698