Index: runtime/vm/object.h |
diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
index 2b43f970ddbf794d8eccee97cd33a6ddcfac9262..22754f86234dd13eaed0061f33457159d447dac5 100644 |
--- a/runtime/vm/object.h |
+++ b/runtime/vm/object.h |
@@ -294,6 +294,9 @@ class Object { |
} |
static RawClass* unwind_error_class() { return unwind_error_class_; } |
static RawClass* icdata_class() { return icdata_class_; } |
+ static RawClass* megamorphic_cache_class() { |
+ return megamorphic_cache_class_; |
+ } |
static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } |
static RawError* Init(Isolate* isolate); |
@@ -428,6 +431,7 @@ class Object { |
static RawClass* context_class_; // Class of the Context vm object. |
static RawClass* context_scope_class_; // Class of ContextScope vm object. |
static RawClass* icdata_class_; // Class of ICData. |
+ static RawClass* megamorphic_cache_class_; // Class of MegamorphiCache. |
static RawClass* subtypetestcache_class_; // Class of SubtypeTestCache. |
static RawClass* api_error_class_; // Class of ApiError. |
static RawClass* language_error_class_; // Class of LanguageError. |
@@ -2926,6 +2930,44 @@ class ICData : public Object { |
}; |
+class MegamorphicCache : public Object { |
+ public: |
+ static const int kInitialCapacity = 16; |
+ static const double kLoadFactor = 0.75; |
+ |
+ RawArray* buckets() const; |
+ void set_buckets(const Array& buckets) const; |
+ |
+ intptr_t mask() const; |
+ void set_mask(intptr_t mask) const; |
+ |
+ intptr_t fill_count() const; |
+ void set_fill_count(intptr_t fill_count) const; |
+ |
+ static intptr_t buckets_offset() { |
+ return OFFSET_OF(RawMegamorphicCache, buckets_); |
+ } |
+ static intptr_t mask_offset() { |
+ return OFFSET_OF(RawMegamorphicCache, mask_); |
+ } |
+ |
+ static RawMegamorphicCache* New(); |
+ |
+ void EnsureCapacity() const; |
+ |
+ void Insert(const Smi& class_id, const Function& target) const; |
+ |
+ static intptr_t InstanceSize() { |
+ return RoundedAllocationSize(sizeof(RawMegamorphicCache)); |
+ } |
+ |
+ private: |
+ friend class Class; |
+ |
+ HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object); |
+}; |
+ |
+ |
class SubtypeTestCache : public Object { |
public: |
enum Entries { |