5 #ifndef V8_IC_STUB_CACHE_H_ 6 #define V8_IC_STUB_CACHE_H_ 8 #include "src/objects/name.h" 21 Address address()
const {
return address_; }
53 enum Table { kPrimary, kSecondary };
57 reinterpret_cast<Address>(&first_entry(table)->key));
60 SCTableReference map_reference(StubCache::Table table) {
61 return SCTableReference(
62 reinterpret_cast<Address>(&first_entry(table)->map));
65 SCTableReference value_reference(StubCache::Table table) {
66 return SCTableReference(
67 reinterpret_cast<Address>(&first_entry(table)->value));
70 StubCache::Entry* first_entry(StubCache::Table table) {
72 case StubCache::kPrimary:
73 return StubCache::primary_;
74 case StubCache::kSecondary:
75 return StubCache::secondary_;
80 Isolate* isolate() {
return isolate_; }
85 static const int kCacheIndexShift = Name::kHashShift;
87 static const int kPrimaryTableBits = 11;
88 static const int kPrimaryTableSize = (1 << kPrimaryTableBits);
89 static const int kSecondaryTableBits = 9;
90 static const int kSecondaryTableSize = (1 << kSecondaryTableBits);
93 static const int kSecondaryMagic = 0xb16ca6e5;
95 static int PrimaryOffsetForTesting(Name name, Map map);
96 static int SecondaryOffsetForTesting(Name name,
int seed);
99 explicit StubCache(Isolate* isolate);
112 static int PrimaryOffset(Name name, Map map);
117 static int SecondaryOffset(Name name,
int seed);
124 static Entry* entry(Entry* table,
int offset) {
125 const int multiplier =
sizeof(*table) >> Name::kHashShift;
126 return reinterpret_cast<Entry*
>(
reinterpret_cast<Address
>(table) +
127 offset * multiplier);
131 Entry primary_[kPrimaryTableSize];
132 Entry secondary_[kSecondaryTableSize];
135 friend class Isolate;
136 friend class SCTableReference;
138 DISALLOW_COPY_AND_ASSIGN(StubCache);
143 #endif // V8_IC_STUB_CACHE_H_