| 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 Isolate; |
| 14 class ObjectPointerVisitor; | 15 class ObjectPointerVisitor; |
| 15 class RawArray; | 16 class RawArray; |
| 16 class RawFunction; | 17 class RawFunction; |
| 17 class RawCode; | 18 class RawCode; |
| 18 class RawMegamorphicCache; | 19 class RawMegamorphicCache; |
| 19 class RawString; | 20 class RawString; |
| 20 class String; | 21 class String; |
| 21 | 22 |
| 22 class MegamorphicCacheTable { | 23 class MegamorphicCacheTable { |
| 23 public: | 24 public: |
| 24 MegamorphicCacheTable(); | 25 explicit MegamorphicCacheTable(Isolate* isolate) : isolate_(isolate) {} |
| 25 ~MegamorphicCacheTable(); | 26 ~MegamorphicCacheTable() {} |
| 26 | 27 |
| 27 RawFunction* miss_handler() const { return miss_handler_function_; } | 28 RawFunction* miss_handler() const; |
| 28 void InitMissHandler(); | 29 void InitMissHandler(); |
| 29 | 30 |
| 30 RawMegamorphicCache* Lookup(const String& name, const Array& descriptor); | 31 RawMegamorphicCache* Lookup(const String& name, const Array& descriptor); |
| 31 | 32 |
| 32 void VisitObjectPointers(ObjectPointerVisitor* visitor); | |
| 33 | |
| 34 void PrintSizes(); | 33 void PrintSizes(); |
| 35 | 34 |
| 36 private: | 35 private: |
| 37 struct Entry { | 36 enum { |
| 38 RawString* name; | 37 kEntryNameOffset = 0, |
| 39 RawArray* descriptor; | 38 kEntryDescriptorOffset, |
| 40 RawMegamorphicCache* cache; | 39 kEntryCacheOffset, |
| 40 kEntrySize |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 static const int kCapacityIncrement = 128; | 43 Isolate* isolate_; |
| 44 | |
| 45 RawFunction* miss_handler_function_; | |
| 46 RawCode* miss_handler_code_; | |
| 47 intptr_t capacity_; | |
| 48 intptr_t length_; | |
| 49 Entry* table_; | |
| 50 | 44 |
| 51 DISALLOW_COPY_AND_ASSIGN(MegamorphicCacheTable); | 45 DISALLOW_COPY_AND_ASSIGN(MegamorphicCacheTable); |
| 52 }; | 46 }; |
| 53 | 47 |
| 54 } // namespace dart | 48 } // namespace dart |
| 55 | 49 |
| 56 #endif // VM_MEGAMORPHIC_CACHE_TABLE_H_ | 50 #endif // VM_MEGAMORPHIC_CACHE_TABLE_H_ |
| OLD | NEW |