Index: runtime/vm/megamorphic_cache_table.h |
diff --git a/runtime/vm/megamorphic_cache_table.h b/runtime/vm/megamorphic_cache_table.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a281957fd541895756c5b19c713c1f3f60ad4122 |
--- /dev/null |
+++ b/runtime/vm/megamorphic_cache_table.h |
@@ -0,0 +1,53 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#ifndef VM_MEGAMORPHIC_CACHE_TABLE_H_ |
+#define VM_MEGAMORPHIC_CACHE_TABLE_H_ |
+ |
+#include "vm/allocation.h" |
+ |
+namespace dart { |
+ |
+class Array; |
+class Function; |
+class ObjectPointerVisitor; |
+class RawArray; |
+class RawFunction; |
+class RawMegamorphicCache; |
+class RawString; |
+class String; |
+ |
+class MegamorphicCacheTable : public ValueObject { |
srdjan
2012/12/03 19:10:46
Don't make it a ValueObject as this indicates to m
Kevin Millikin (Google)
2012/12/06 14:03:11
Done.
|
+ public: |
+ MegamorphicCacheTable(); |
+ ~MegamorphicCacheTable(); |
+ |
+ RawFunction* miss_handler() const { return miss_handler_; } |
+ void InitMissHandler(); |
+ |
+ RawMegamorphicCache* Lookup(const String& name, const Array& descriptor); |
+ |
+ void VisitObjectPointers(ObjectPointerVisitor* visitor); |
+ |
+ void PrintSizes(); |
+ |
+ private: |
+ struct Entry { |
+ RawString* name; |
+ RawArray* descriptor; |
+ RawMegamorphicCache* cache; |
+ }; |
+ |
+ static const int kInitialCapacity = 128; |
+ static const int kCapacityIncrement = 128; |
+ |
+ RawFunction* miss_handler_; |
+ intptr_t capacity_; |
+ intptr_t length_; |
+ Entry* table_; |
srdjan
2012/12/03 19:10:46
DISALLOW_YADYADA...
Kevin Millikin (Google)
2012/12/06 14:03:11
Done.
|
+}; |
srdjan
2012/12/03 19:10:46
You can use RawGrowableObjectArray* table_, then y
Kevin Millikin (Google)
2012/12/06 14:03:11
Thanks for the good idea. I'll hold that off for
|
+ |
+} // namespace dart |
+ |
+#endif // VM_MEGAMORPHIC_CACHE_TABLE_H_ |