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