Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 3cbbee3d78d3d68b7dfc0c18672ba3b1c131246b..c2da7b822777197f34a30d162060137f052119c3 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -315,6 +315,7 @@ static const int kVariableSizeSentinel = 0; |
V(TYPE_SWITCH_INFO_TYPE) \ |
V(SCRIPT_TYPE) \ |
V(CODE_CACHE_TYPE) \ |
+ V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
\ |
V(FIXED_ARRAY_TYPE) \ |
V(SHARED_FUNCTION_INFO_TYPE) \ |
@@ -424,7 +425,8 @@ static const int kVariableSizeSentinel = 0; |
V(SIGNATURE_INFO, SignatureInfo, signature_info) \ |
V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
V(SCRIPT, Script, script) \ |
- V(CODE_CACHE, CodeCache, code_cache) |
+ V(CODE_CACHE, CodeCache, code_cache) \ |
+ V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) |
#ifdef ENABLE_DEBUGGER_SUPPORT |
#define STRUCT_LIST_DEBUGGER(V) \ |
@@ -542,6 +544,7 @@ enum InstanceType { |
TYPE_SWITCH_INFO_TYPE, |
SCRIPT_TYPE, |
CODE_CACHE_TYPE, |
+ POLYMORPHIC_CODE_CACHE_TYPE, |
// The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
// is defined. However as include/v8.h contain some of the instance type |
// constants always having them avoids them getting different numbers |
@@ -738,6 +741,7 @@ class MaybeObject BASE_EMBEDDED { |
V(NormalizedMapCache) \ |
V(CompilationCacheTable) \ |
V(CodeCacheHashTable) \ |
+ V(PolymorphicCodeCacheHashTable) \ |
V(MapCache) \ |
V(Primitive) \ |
V(GlobalObject) \ |
@@ -2790,11 +2794,6 @@ class NormalizedMapCache: public FixedArray { |
#ifdef DEBUG |
void NormalizedMapCacheVerify(); |
#endif |
- |
- private: |
- static int Hash(Map* fast); |
- |
- static bool CheckHit(Map* slow, Map* fast, PropertyNormalizationMode mode); |
}; |
@@ -3898,6 +3897,13 @@ class Map: public HeapObject { |
// following back pointers. |
void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); |
+ // Computes a hash value for this map, to be used in HashTables and such. |
+ int Hash(); |
+ |
+ // Compares this map to another. |mode| affects how |other| is looked at. |
Mads Ager (chromium)
2011/06/01 08:45:53
Could you update the comment to state which effect
Jakob Kummerow
2011/06/01 10:15:27
OK. I agree that "Equals" isn't a good name. Here
Mads Ager (chromium)
2011/06/01 10:36:54
They are not really ignored. If you are about to c
Jakob Kummerow
2011/06/01 12:03:09
Done.
|
+ // The "shared" flags of both |this| and |other| are ignored. |
+ bool Equals(Map* other, PropertyNormalizationMode mode); |
+ |
// Dispatched behavior. |
#ifdef OBJECT_PRINT |
inline void MapPrint() { |
@@ -5299,6 +5305,49 @@ class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape, |
}; |
+class PolymorphicCodeCache: public Struct { |
+ public: |
+ DECL_ACCESSORS(cache, Object) |
+ |
+ MUST_USE_RESULT MaybeObject* Update(MapList* maps, |
+ Code::Flags flags, |
+ Code* code); |
+ Object* Lookup(MapList* maps, Code::Flags flags); |
+ |
+ static inline PolymorphicCodeCache* cast(Object* obj); |
+ |
+#ifdef OBJECT_PRINT |
+ inline void PolymorphicCodeCachePrint() { |
+ PolymorphicCodeCachePrint(stdout); |
+ } |
+ void PolymorphicCodeCachePrint(FILE* out); |
+#endif |
+#ifdef DEBUG |
+ void PolymorphicCodeCacheVerify(); |
+#endif |
+ |
+ static const int kCacheOffset = HeapObject::kHeaderSize; |
+ static const int kSize = kCacheOffset + kPointerSize; |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); |
+}; |
+ |
+ |
+class PolymorphicCodeCacheHashTable |
+ : public HashTable<CodeCacheHashTableShape, HashTableKey*> { |
+ public: |
+ Object* Lookup(MapList* maps, int code_kind); |
+ MUST_USE_RESULT MaybeObject* Put(MapList* maps, int code_kind, Code* code); |
+ |
+ static inline PolymorphicCodeCacheHashTable* cast(Object* obj); |
+ |
+ static const int kInitialSize = 64; |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); |
+}; |
+ |
+ |
enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; |
enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; |