Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 01d8f6b57969271e720b6ca0e63220142fc9b843..529dfa6cc2577fa8fa904abf304dbe87b9b8f30f 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -398,8 +398,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; |
V(ALLOCATION_MEMENTO_TYPE) \ |
V(ALLOCATION_SITE_TYPE) \ |
V(SCRIPT_TYPE) \ |
- V(CODE_CACHE_TYPE) \ |
- V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
V(TYPE_FEEDBACK_INFO_TYPE) \ |
V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
V(BOX_TYPE) \ |
@@ -514,8 +512,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; |
V(SCRIPT, Script, script) \ |
V(ALLOCATION_SITE, AllocationSite, allocation_site) \ |
V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \ |
- V(CODE_CACHE, CodeCache, code_cache) \ |
- V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ |
V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \ |
V(DEBUG_INFO, DebugInfo, debug_info) \ |
@@ -685,8 +681,6 @@ enum InstanceType { |
ALLOCATION_SITE_TYPE, |
ALLOCATION_MEMENTO_TYPE, |
SCRIPT_TYPE, |
- CODE_CACHE_TYPE, |
- POLYMORPHIC_CODE_CACHE_TYPE, |
TYPE_FEEDBACK_INFO_TYPE, |
ALIASED_ARGUMENTS_ENTRY_TYPE, |
BOX_TYPE, |
@@ -981,7 +975,6 @@ template <class C> inline bool Is(Object* obj); |
V(NormalizedMapCache) \ |
V(CompilationCacheTable) \ |
V(CodeCacheHashTable) \ |
- V(PolymorphicCodeCacheHashTable) \ |
V(MapCache) \ |
V(JSGlobalObject) \ |
V(JSGlobalProxy) \ |
@@ -4941,18 +4934,11 @@ class Code: public HeapObject { |
static const char* Kind2String(Kind kind); |
- // Types of stubs. |
- enum StubType { |
- NORMAL, |
- FAST |
- }; |
- |
static const int kPrologueOffsetNotSet = -1; |
#ifdef ENABLE_DISASSEMBLER |
// Printing |
static const char* ICState2String(InlineCacheState state); |
- static const char* StubType2String(StubType type); |
static void PrintExtraICState(std::ostream& os, // NOLINT |
Kind kind, ExtraICState extra); |
void Disassemble(const char* name, std::ostream& os); // NOLINT |
@@ -5022,8 +5008,6 @@ class Code: public HeapObject { |
inline InlineCacheState ic_state(); // Only valid for IC stubs. |
inline ExtraICState extra_ic_state(); // Only valid for IC stubs. |
- inline StubType type(); // Only valid for monomorphic IC stubs. |
- |
// Testers for IC stub kinds. |
inline bool is_inline_cache_stub(); |
inline bool is_debug_stub(); |
@@ -5179,25 +5163,22 @@ class Code: public HeapObject { |
// Flags operations. |
static inline Flags ComputeFlags( |
Kind kind, InlineCacheState ic_state = UNINITIALIZED, |
- ExtraICState extra_ic_state = kNoExtraICState, StubType type = NORMAL, |
+ ExtraICState extra_ic_state = kNoExtraICState, |
CacheHolderFlag holder = kCacheOnReceiver); |
static inline Flags ComputeMonomorphicFlags( |
Kind kind, ExtraICState extra_ic_state = kNoExtraICState, |
- CacheHolderFlag holder = kCacheOnReceiver, StubType type = NORMAL); |
+ CacheHolderFlag holder = kCacheOnReceiver); |
static inline Flags ComputeHandlerFlags( |
- Kind handler_kind, StubType type = NORMAL, |
- CacheHolderFlag holder = kCacheOnReceiver); |
+ Kind handler_kind, CacheHolderFlag holder = kCacheOnReceiver); |
static inline InlineCacheState ExtractICStateFromFlags(Flags flags); |
- static inline StubType ExtractTypeFromFlags(Flags flags); |
static inline CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); |
static inline Kind ExtractKindFromFlags(Flags flags); |
static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); |
- static inline Flags RemoveTypeFromFlags(Flags flags); |
- static inline Flags RemoveTypeAndHolderFromFlags(Flags flags); |
+ static inline Flags RemoveHolderFromFlags(Flags flags); |
// Convert a target address into a code object. |
static inline Code* GetCodeFromTargetAddress(Address address); |
@@ -5362,12 +5343,11 @@ class Code: public HeapObject { |
// Flags layout. BitField<type, shift, size>. |
class ICStateField : public BitField<InlineCacheState, 0, 3> {}; |
- class TypeField : public BitField<StubType, 3, 1> {}; |
- class CacheHolderField : public BitField<CacheHolderFlag, 4, 2> {}; |
- class KindField : public BitField<Kind, 6, 5> {}; |
+ class CacheHolderField : public BitField<CacheHolderFlag, 3, 2> {}; |
+ class KindField : public BitField<Kind, 5, 5> {}; |
class ExtraICStateField |
- : public BitField<ExtraICState, 11, PlatformSmiTagging::kSmiValueSize - |
- 11 + 1> {}; // NOLINT |
+ : public BitField<ExtraICState, 10, PlatformSmiTagging::kSmiValueSize - |
+ 10 + 1> {}; // NOLINT |
// KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION) |
static const int kStackSlotsFirstBit = 0; |
@@ -5417,8 +5397,7 @@ class Code: public HeapObject { |
static const int kMaxArguments = (1 << kArgumentsBits) - 1; |
// This constant should be encodable in an ARM instruction. |
- static const int kFlagsNotUsedInLookup = |
- TypeField::kMask | CacheHolderField::kMask; |
+ static const int kFlagsNotUsedInLookup = CacheHolderField::kMask; |
private: |
friend class RelocIterator; |
@@ -6078,15 +6057,7 @@ class Map: public HeapObject { |
static void EnsureDescriptorSlack(Handle<Map> map, int slack); |
- // Returns the found code or undefined if absent. |
- Object* FindInCodeCache(Name* name, Code::Flags flags); |
- |
- // Returns the non-negative index of the code object if it is in the |
- // cache and -1 otherwise. |
- int IndexInCodeCache(Object* name, Code* code); |
- |
- // Removes a code object from the code cache at the given index. |
- void RemoveFromCodeCache(Name* name, Code* code, int index); |
+ Code* LookupInCodeCache(Name* name, Code::Flags code); |
// Computes a hash value for this map, to be used in HashTables and such. |
int Hash(); |
@@ -8129,57 +8100,6 @@ class CompilationCacheTable: public HashTable<CompilationCacheTable, |
}; |
-class CodeCache: public Struct { |
- public: |
- DECL_ACCESSORS(default_cache, FixedArray) |
- DECL_ACCESSORS(normal_type_cache, Object) |
- |
- // Add the code object to the cache. |
- static void Update( |
- Handle<CodeCache> cache, Handle<Name> name, Handle<Code> code); |
- |
- // Lookup code object in the cache. Returns code object if found and undefined |
- // if not. |
- Object* Lookup(Name* name, Code::Flags flags); |
- |
- // Get the internal index of a code object in the cache. Returns -1 if the |
- // code object is not in that cache. This index can be used to later call |
- // RemoveByIndex. The cache cannot be modified between a call to GetIndex and |
- // RemoveByIndex. |
- int GetIndex(Object* name, Code* code); |
- |
- // Remove an object from the cache with the provided internal index. |
- void RemoveByIndex(Object* name, Code* code, int index); |
- |
- DECLARE_CAST(CodeCache) |
- |
- // Dispatched behavior. |
- DECLARE_PRINTER(CodeCache) |
- DECLARE_VERIFIER(CodeCache) |
- |
- static const int kDefaultCacheOffset = HeapObject::kHeaderSize; |
- static const int kNormalTypeCacheOffset = |
- kDefaultCacheOffset + kPointerSize; |
- static const int kSize = kNormalTypeCacheOffset + kPointerSize; |
- |
- private: |
- static void UpdateDefaultCache( |
- Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code); |
- static void UpdateNormalTypeCache( |
- Handle<CodeCache> code_cache, Handle<Name> name, Handle<Code> code); |
- Object* LookupDefaultCache(Name* name, Code::Flags flags); |
- Object* LookupNormalTypeCache(Name* name, Code::Flags flags); |
- |
- // Code cache layout of the default cache. Elements are alternating name and |
- // code objects for non normal load/store/call IC's. |
- static const int kCodeCacheEntrySize = 2; |
- static const int kCodeCacheEntryNameOffset = 0; |
- static const int kCodeCacheEntryCodeOffset = 1; |
- |
- DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); |
-}; |
- |
- |
class CodeCacheHashTableShape : public BaseShape<HashTableKey*> { |
public: |
static inline bool IsMatch(HashTableKey* key, Object* value) { |
@@ -8197,7 +8117,11 @@ class CodeCacheHashTableShape : public BaseShape<HashTableKey*> { |
static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key); |
static const int kPrefixSize = 0; |
- static const int kEntrySize = 2; |
+ // The both the key (name + flags) and value (code object) can be derived from |
+ // the fixed array that stores both the name and code. |
+ // TODO(verwaest): Don't allocate a fixed array but inline name and code. |
+ // Rewrite IsMatch to get table + index as input rather than just the raw key. |
+ static const int kEntrySize = 1; |
}; |
@@ -8205,73 +8129,23 @@ class CodeCacheHashTable: public HashTable<CodeCacheHashTable, |
CodeCacheHashTableShape, |
HashTableKey*> { |
public: |
- Object* Lookup(Name* name, Code::Flags flags); |
static Handle<CodeCacheHashTable> Put( |
Handle<CodeCacheHashTable> table, |
Handle<Name> name, |
Handle<Code> code); |
- int GetIndex(Name* name, Code::Flags flags); |
- void RemoveByIndex(int index); |
+ Code* Lookup(Name* name, Code::Flags flags); |
DECLARE_CAST(CodeCacheHashTable) |
// Initial size of the fixed array backing the hash table. |
- static const int kInitialSize = 64; |
+ static const int kInitialSize = 16; |
private: |
DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); |
}; |
-class PolymorphicCodeCache: public Struct { |
- public: |
- DECL_ACCESSORS(cache, Object) |
- |
- static void Update(Handle<PolymorphicCodeCache> cache, |
- MapHandleList* maps, |
- Code::Flags flags, |
- Handle<Code> code); |
- |
- |
- // Returns an undefined value if the entry is not found. |
- Handle<Object> Lookup(MapHandleList* maps, Code::Flags flags); |
- |
- DECLARE_CAST(PolymorphicCodeCache) |
- |
- // Dispatched behavior. |
- DECLARE_PRINTER(PolymorphicCodeCache) |
- DECLARE_VERIFIER(PolymorphicCodeCache) |
- |
- static const int kCacheOffset = HeapObject::kHeaderSize; |
- static const int kSize = kCacheOffset + kPointerSize; |
- |
- private: |
- DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); |
-}; |
- |
- |
-class PolymorphicCodeCacheHashTable |
- : public HashTable<PolymorphicCodeCacheHashTable, |
- CodeCacheHashTableShape, |
- HashTableKey*> { |
- public: |
- Object* Lookup(MapHandleList* maps, int code_kind); |
- |
- static Handle<PolymorphicCodeCacheHashTable> Put( |
- Handle<PolymorphicCodeCacheHashTable> hash_table, |
- MapHandleList* maps, |
- int code_kind, |
- Handle<Code> code); |
- |
- DECLARE_CAST(PolymorphicCodeCacheHashTable) |
- |
- static const int kInitialSize = 64; |
- private: |
- DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); |
-}; |
- |
- |
class TypeFeedbackInfo: public Struct { |
public: |
inline int ic_total_count(); |