OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 VM_INSTRUCTIONS_ARM64_H_ | 6 #ifndef VM_INSTRUCTIONS_ARM64_H_ |
7 #define VM_INSTRUCTIONS_ARM64_H_ | 7 #define VM_INSTRUCTIONS_ARM64_H_ |
8 | 8 |
9 #ifndef VM_INSTRUCTIONS_H_ | 9 #ifndef VM_INSTRUCTIONS_H_ |
10 #error Do not include instructions_arm64.h directly; use instructions.h instead. | 10 #error Do not include instructions_arm64.h directly; use instructions.h instead. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 static intptr_t OffsetFromPPIndex(intptr_t index); | 54 static intptr_t OffsetFromPPIndex(intptr_t index); |
55 }; | 55 }; |
56 | 56 |
57 | 57 |
58 class CallPattern : public ValueObject { | 58 class CallPattern : public ValueObject { |
59 public: | 59 public: |
60 CallPattern(uword pc, const Code& code); | 60 CallPattern(uword pc, const Code& code); |
61 | 61 |
62 RawICData* IcData(); | 62 RawICData* IcData(); |
63 | 63 |
64 uword TargetAddress() const; | 64 RawCode* TargetCode() const; |
65 void SetTargetAddress(uword target_address) const; | 65 void SetTargetCode(const Code& target) const; |
66 | 66 |
67 // This constant length is only valid for inserted call patterns used for | 67 // This constant length is only valid for inserted call patterns used for |
68 // lazy deoptimization. Regular call pattern may vary in length. | 68 // lazy deoptimization. Regular call pattern may vary in length. |
69 static const int kLengthInBytes = 5 * Instr::kInstrSize; | 69 static const int kDeoptCallLengthInBytes = 5 * Instr::kInstrSize; |
70 | 70 |
71 static void InsertAt(uword pc, uword target_address); | 71 static void InsertDeoptCallAt(uword pc, uword target_address); |
72 | 72 |
73 private: | 73 private: |
74 const ObjectPool& object_pool_; | 74 const ObjectPool& object_pool_; |
75 | 75 |
76 uword end_; | 76 uword end_; |
77 uword ic_data_load_end_; | 77 uword ic_data_load_end_; |
78 | 78 |
79 intptr_t target_address_pool_index_; | 79 intptr_t target_code_pool_index_; |
80 ICData& ic_data_; | 80 ICData& ic_data_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(CallPattern); | 82 DISALLOW_COPY_AND_ASSIGN(CallPattern); |
83 }; | 83 }; |
84 | 84 |
85 | 85 |
86 class NativeCallPattern : public ValueObject { | 86 class NativeCallPattern : public ValueObject { |
87 public: | 87 public: |
88 NativeCallPattern(uword pc, const Code& code); | 88 NativeCallPattern(uword pc, const Code& code); |
89 | 89 |
90 uword target() const; | 90 RawCode* target() const; |
91 void set_target(uword target_address) const; | 91 void set_target(const Code& target) const; |
92 | 92 |
93 NativeFunction native_function() const; | 93 NativeFunction native_function() const; |
94 void set_native_function(NativeFunction target) const; | 94 void set_native_function(NativeFunction target) const; |
95 | 95 |
96 private: | 96 private: |
97 const ObjectPool& object_pool_; | 97 const ObjectPool& object_pool_; |
98 | 98 |
99 uword end_; | 99 uword end_; |
100 intptr_t native_function_pool_index_; | 100 intptr_t native_function_pool_index_; |
101 intptr_t target_address_pool_index_; | 101 intptr_t target_code_pool_index_; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); | 103 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); |
104 }; | 104 }; |
105 | 105 |
106 | 106 |
107 class JumpPattern : public ValueObject { | |
108 public: | |
109 JumpPattern(uword pc, const Code& code); | |
110 | |
111 static const int kLengthInBytes = 5 * Instr::kInstrSize; | |
112 | |
113 int pattern_length_in_bytes() const { | |
114 return kLengthInBytes; | |
115 } | |
116 | |
117 bool IsValid() const; | |
118 uword TargetAddress() const; | |
119 void SetTargetAddress(uword target_address) const; | |
120 | |
121 private: | |
122 const uword pc_; | |
123 | |
124 DISALLOW_COPY_AND_ASSIGN(JumpPattern); | |
125 }; | |
126 | |
127 | |
128 class ReturnPattern : public ValueObject { | 107 class ReturnPattern : public ValueObject { |
129 public: | 108 public: |
130 explicit ReturnPattern(uword pc); | 109 explicit ReturnPattern(uword pc); |
131 | 110 |
132 // bx_lr = 1. | 111 // bx_lr = 1. |
133 static const int kLengthInBytes = 1 * Instr::kInstrSize; | 112 static const int kLengthInBytes = 1 * Instr::kInstrSize; |
134 | 113 |
135 int pattern_length_in_bytes() const { | 114 int pattern_length_in_bytes() const { |
136 return kLengthInBytes; | 115 return kLengthInBytes; |
137 } | 116 } |
138 | 117 |
139 bool IsValid() const; | 118 bool IsValid() const; |
140 | 119 |
141 private: | 120 private: |
142 const uword pc_; | 121 const uword pc_; |
143 }; | 122 }; |
144 | 123 |
145 } // namespace dart | 124 } // namespace dart |
146 | 125 |
147 #endif // VM_INSTRUCTIONS_ARM64_H_ | 126 #endif // VM_INSTRUCTIONS_ARM64_H_ |
OLD | NEW |