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