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

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

Issue 2147213004: Revert of [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: 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 1115402e716a737334556b1e4e944511935c0d26..b636aacc76566bfc1a36ec22119047368c5e6279 100644
--- a/src/ic/stub-cache.h
+++ b/src/ic/stub-cache.h
@@ -41,12 +41,13 @@
void Initialize();
// Access cache for entry hash(name, map).
Code* Set(Name* name, Map* map, Code* code);
- Code* Get(Name* name, Map* map);
+ Code* Get(Name* name, Map* map, Code::Flags flags);
// Clear the lookup table (@ mark compact collection).
void Clear();
- // Collect all maps that match the name.
+ // Collect all maps that match the name and flags.
void CollectMatchingMaps(SmallMapList* types, Handle<Name> name,
- Handle<Context> native_context, Zone* zone);
+ Code::Flags flags, 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,12 +97,13 @@
static const int kSecondaryTableBits = 9;
static const int kSecondaryTableSize = (1 << kSecondaryTableBits);
- static int PrimaryOffsetForTesting(Name* name, Map* map) {
- return PrimaryOffset(name, map);
+ static int PrimaryOffsetForTesting(Name* name, Code::Flags flags, Map* map) {
+ return PrimaryOffset(name, flags, map);
}
- static int SecondaryOffsetForTesting(Name* name, int seed) {
- return SecondaryOffset(name, seed);
+ static int SecondaryOffsetForTesting(Name* name, Code::Flags flags,
+ int seed) {
+ return SecondaryOffset(name, flags, seed);
}
// The constructor is made public only for the purposes of testing.
@@ -118,7 +120,7 @@
// 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, Map* map) {
+ static int PrimaryOffset(Name* name, Code::Flags flags, Map* map) {
STATIC_ASSERT(kCacheIndexShift == Name::kHashShift);
// Compute the hash of the name (use entire hash field).
DCHECK(name->HasHashCode());
@@ -128,19 +130,27 @@
// 4Gb (and not at all if it isn't).
uint32_t map_low32bits =
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map));
- // Base the offset on a simple combination of name and map.
- uint32_t key = map_low32bits + field;
+ // 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;
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, int seed) {
+ static int SecondaryOffset(Name* name, Code::Flags flags, 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));
- uint32_t key = (seed - name_low32bits);
+ // 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;
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