OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef VM_MEGAMORPHIC_CACHE_TABLE_H_ |
| 6 #define VM_MEGAMORPHIC_CACHE_TABLE_H_ |
| 7 |
| 8 #include "vm/allocation.h" |
| 9 |
| 10 namespace dart { |
| 11 |
| 12 class Array; |
| 13 class Function; |
| 14 class ObjectPointerVisitor; |
| 15 class RawArray; |
| 16 class RawFunction; |
| 17 class RawMegamorphicCache; |
| 18 class RawString; |
| 19 class String; |
| 20 |
| 21 class MegamorphicCacheTable { |
| 22 public: |
| 23 MegamorphicCacheTable(); |
| 24 ~MegamorphicCacheTable(); |
| 25 |
| 26 RawFunction* miss_handler() const { return miss_handler_; } |
| 27 void InitMissHandler(); |
| 28 |
| 29 RawMegamorphicCache* Lookup(const String& name, const Array& descriptor); |
| 30 |
| 31 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 32 |
| 33 void PrintSizes(); |
| 34 |
| 35 private: |
| 36 struct Entry { |
| 37 RawString* name; |
| 38 RawArray* descriptor; |
| 39 RawMegamorphicCache* cache; |
| 40 }; |
| 41 |
| 42 static const int kInitialCapacity = 128; |
| 43 static const int kCapacityIncrement = 128; |
| 44 |
| 45 RawFunction* miss_handler_; |
| 46 intptr_t capacity_; |
| 47 intptr_t length_; |
| 48 Entry* table_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(MegamorphicCacheTable); |
| 51 }; |
| 52 |
| 53 } // namespace dart |
| 54 |
| 55 #endif // VM_MEGAMORPHIC_CACHE_TABLE_H_ |
OLD | NEW |