| Index: src/stub-cache.h
|
| diff --git a/src/stub-cache.h b/src/stub-cache.h
|
| index 8c863e1bd895eb8e46c4896336393483248f40fa..4687c1cb2baf5992886d0cb500d42dd627f2686c 100644
|
| --- a/src/stub-cache.h
|
| +++ b/src/stub-cache.h
|
| @@ -183,6 +183,11 @@ class StubCache {
|
| static const int kInterceptorArgsHolderIndex = 3;
|
| static const int kInterceptorArgsLength = 4;
|
|
|
| + // Setting the entry size such that the index is shifted by Name::kHashShift
|
| + // is convenient; shifting down the length field (to extract the hash code)
|
| + // automatically discards the hash bit field.
|
| + static const int kCacheIndexShift = Name::kHashShift;
|
| +
|
| private:
|
| explicit StubCache(Isolate* isolate);
|
|
|
| @@ -195,13 +200,9 @@ 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 << kHeapObjectTagSize.
|
| + // is scaled by 1 << kCacheIndexShift.
|
| static int PrimaryOffset(Name* name, Code::Flags flags, Map* map) {
|
| - // This works well because the heap object tag size and the hash
|
| - // shift are equal. Shifting down the length field to get the
|
| - // hash code would effectively throw away two bits of the hash
|
| - // code.
|
| - STATIC_ASSERT(kHeapObjectTagSize == Name::kHashShift);
|
| + STATIC_ASSERT(kCacheIndexShift == Name::kHashShift);
|
| // Compute the hash of the name (use entire hash field).
|
| ASSERT(name->HasHashCode());
|
| uint32_t field = name->hash_field();
|
| @@ -216,12 +217,12 @@ class StubCache {
|
| (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) << kHeapObjectTagSize);
|
| + 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 << kHeapObjectTagSize.
|
| + // is scaled by 1 << kCacheIndexShift.
|
| 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 =
|
| @@ -231,7 +232,7 @@ class StubCache {
|
| uint32_t iflags =
|
| (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup);
|
| uint32_t key = (seed - name_low32bits) + iflags;
|
| - return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize);
|
| + return key & ((kSecondaryTableSize - 1) << kCacheIndexShift);
|
| }
|
|
|
| // Compute the entry for a given offset in exactly the same way as
|
|
|