OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // Classes that describe assembly patterns as used by inline caches. | 4 // Classes that describe assembly patterns as used by inline caches. |
5 | 5 |
6 #ifndef RUNTIME_VM_INSTRUCTIONS_DBC_H_ | 6 #ifndef RUNTIME_VM_INSTRUCTIONS_DBC_H_ |
7 #define RUNTIME_VM_INSTRUCTIONS_DBC_H_ | 7 #define RUNTIME_VM_INSTRUCTIONS_DBC_H_ |
8 | 8 |
9 #ifndef RUNTIME_VM_INSTRUCTIONS_H_ | 9 #ifndef RUNTIME_VM_INSTRUCTIONS_H_ |
10 #error Do not include instructions_dbc.h directly; use instructions.h instead. | 10 #error Do not include instructions_dbc.h directly; use instructions.h instead. |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Decodes a load sequence ending at 'end' (the last instruction of the | 40 // Decodes a load sequence ending at 'end' (the last instruction of the |
41 // load sequence is the instruction before the one at end). Returns the | 41 // load sequence is the instruction before the one at end). Returns the |
42 // address of the first instruction in the sequence. Returns the register | 42 // address of the first instruction in the sequence. Returns the register |
43 // being loaded and the index in the pool being read from in the output | 43 // being loaded and the index in the pool being read from in the output |
44 // parameters 'reg' and 'index' respectively. | 44 // parameters 'reg' and 'index' respectively. |
45 static uword DecodeLoadWordFromPool(uword end, | 45 static uword DecodeLoadWordFromPool(uword end, |
46 Register* reg, | 46 Register* reg, |
47 intptr_t* index); | 47 intptr_t* index); |
48 }; | 48 }; |
49 | 49 |
50 | |
51 class CallPattern : public ValueObject { | 50 class CallPattern : public ValueObject { |
52 public: | 51 public: |
53 CallPattern(uword pc, const Code& code); | 52 CallPattern(uword pc, const Code& code); |
54 | 53 |
55 RawICData* IcData(); | 54 RawICData* IcData(); |
56 | 55 |
57 RawCode* TargetCode() const; | 56 RawCode* TargetCode() const; |
58 void SetTargetCode(const Code& code) const; | 57 void SetTargetCode(const Code& code) const; |
59 | 58 |
60 static void InsertDeoptCallAt(uword pc); | 59 static void InsertDeoptCallAt(uword pc); |
61 | 60 |
62 private: | 61 private: |
63 const ObjectPool& object_pool_; | 62 const ObjectPool& object_pool_; |
64 | 63 |
65 uword end_; | 64 uword end_; |
66 uword ic_data_load_end_; | 65 uword ic_data_load_end_; |
67 | 66 |
68 intptr_t target_code_pool_index_; | 67 intptr_t target_code_pool_index_; |
69 ICData& ic_data_; | 68 ICData& ic_data_; |
70 | 69 |
71 DISALLOW_COPY_AND_ASSIGN(CallPattern); | 70 DISALLOW_COPY_AND_ASSIGN(CallPattern); |
72 }; | 71 }; |
73 | 72 |
74 | |
75 class NativeCallPattern : public ValueObject { | 73 class NativeCallPattern : public ValueObject { |
76 public: | 74 public: |
77 NativeCallPattern(uword pc, const Code& code); | 75 NativeCallPattern(uword pc, const Code& code); |
78 | 76 |
79 RawCode* target() const; | 77 RawCode* target() const; |
80 void set_target(const Code& target) const; | 78 void set_target(const Code& target) const; |
81 | 79 |
82 NativeFunction native_function() const; | 80 NativeFunction native_function() const; |
83 void set_native_function(NativeFunction target) const; | 81 void set_native_function(NativeFunction target) const; |
84 | 82 |
85 private: | 83 private: |
86 const ObjectPool& object_pool_; | 84 const ObjectPool& object_pool_; |
87 | 85 |
88 uword end_; | 86 uword end_; |
89 intptr_t native_function_pool_index_; | 87 intptr_t native_function_pool_index_; |
90 intptr_t target_code_pool_index_; | 88 intptr_t target_code_pool_index_; |
91 | 89 |
92 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); | 90 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); |
93 }; | 91 }; |
94 | 92 |
95 | |
96 // Instance call that can switch between a direct monomorphic call, an IC call, | 93 // Instance call that can switch between a direct monomorphic call, an IC call, |
97 // and a megamorphic call. | 94 // and a megamorphic call. |
98 // load guarded cid load ICData load MegamorphicCache | 95 // load guarded cid load ICData load MegamorphicCache |
99 // load monomorphic target <-> load ICLookup stub -> load MMLookup stub | 96 // load monomorphic target <-> load ICLookup stub -> load MMLookup stub |
100 // call target.entry call stub.entry call stub.entry | 97 // call target.entry call stub.entry call stub.entry |
101 class SwitchableCallPattern : public ValueObject { | 98 class SwitchableCallPattern : public ValueObject { |
102 public: | 99 public: |
103 SwitchableCallPattern(uword pc, const Code& code); | 100 SwitchableCallPattern(uword pc, const Code& code); |
104 | 101 |
105 RawObject* data() const; | 102 RawObject* data() const; |
106 RawCode* target() const; | 103 RawCode* target() const; |
107 void SetData(const Object& data) const; | 104 void SetData(const Object& data) const; |
108 void SetTarget(const Code& target) const; | 105 void SetTarget(const Code& target) const; |
109 | 106 |
110 private: | 107 private: |
111 const ObjectPool& object_pool_; | 108 const ObjectPool& object_pool_; |
112 intptr_t data_pool_index_; | 109 intptr_t data_pool_index_; |
113 intptr_t target_pool_index_; | 110 intptr_t target_pool_index_; |
114 | 111 |
115 DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); | 112 DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); |
116 }; | 113 }; |
117 | 114 |
118 | |
119 class ReturnPattern : public ValueObject { | 115 class ReturnPattern : public ValueObject { |
120 public: | 116 public: |
121 explicit ReturnPattern(uword pc); | 117 explicit ReturnPattern(uword pc); |
122 | 118 |
123 static const int kLengthInBytes = 0; | 119 static const int kLengthInBytes = 0; |
124 | 120 |
125 int pattern_length_in_bytes() const { | 121 int pattern_length_in_bytes() const { |
126 UNIMPLEMENTED(); | 122 UNIMPLEMENTED(); |
127 return kLengthInBytes; | 123 return kLengthInBytes; |
128 } | 124 } |
129 | 125 |
130 bool IsValid() const; | 126 bool IsValid() const; |
131 | 127 |
132 private: | 128 private: |
133 const uword pc_; | 129 const uword pc_; |
134 }; | 130 }; |
135 | 131 |
136 } // namespace dart | 132 } // namespace dart |
137 | 133 |
138 #endif // RUNTIME_VM_INSTRUCTIONS_DBC_H_ | 134 #endif // RUNTIME_VM_INSTRUCTIONS_DBC_H_ |
OLD | NEW |