Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(936)

Unified Diff: runtime/vm/object.h

Issue 11299298: Cache lookups at megamorphic call sites in optimized code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698