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