OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ | 5 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ |
6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ | 6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/arm64/assembler-arm64.h" | 10 #include "src/arm64/assembler-arm64.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 enum TargetAddressStorageMode { | 155 enum TargetAddressStorageMode { |
156 CAN_INLINE_TARGET_ADDRESS, | 156 CAN_INLINE_TARGET_ADDRESS, |
157 NEVER_INLINE_TARGET_ADDRESS | 157 NEVER_INLINE_TARGET_ADDRESS |
158 }; | 158 }; |
159 enum UntagMode { kNotSpeculativeUntag, kSpeculativeUntag }; | 159 enum UntagMode { kNotSpeculativeUntag, kSpeculativeUntag }; |
160 enum ArrayHasHoles { kArrayCantHaveHoles, kArrayCanHaveHoles }; | 160 enum ArrayHasHoles { kArrayCantHaveHoles, kArrayCanHaveHoles }; |
161 enum CopyHint { kCopyUnknown, kCopyShort, kCopyLong }; | 161 enum CopyHint { kCopyUnknown, kCopyShort, kCopyLong }; |
162 enum DiscardMoveMode { kDontDiscardForSameWReg, kDiscardForSameWReg }; | 162 enum DiscardMoveMode { kDontDiscardForSameWReg, kDiscardForSameWReg }; |
163 enum SeqStringSetCharCheckIndexType { kIndexIsSmi, kIndexIsInteger32 }; | 163 enum SeqStringSetCharCheckIndexType { kIndexIsSmi, kIndexIsInteger32 }; |
164 | 164 |
| 165 // The macro assembler supports moving automatically pre-shifted immediates for |
| 166 // arithmetic and logical instructions, and then applying a post shift in the |
| 167 // instruction to undo the modification, in order to reduce the code emitted for |
| 168 // an operation. For example: |
| 169 // |
| 170 // Add(x0, x0, 0x1f7de) => movz x16, 0xfbef; add x0, x0, x16, lsl #1. |
| 171 // |
| 172 // This optimisation can be only partially applied when the stack pointer is an |
| 173 // operand or destination, so this enumeration is used to control the shift. |
| 174 enum PreShiftImmMode { |
| 175 kNoShift, // Don't pre-shift. |
| 176 kLimitShiftForSP, // Limit pre-shift for add/sub extend use. |
| 177 kAnyShift // Allow any pre-shift. |
| 178 }; |
| 179 |
165 class MacroAssembler : public Assembler { | 180 class MacroAssembler : public Assembler { |
166 public: | 181 public: |
167 MacroAssembler(Isolate* isolate, byte* buffer, unsigned buffer_size, | 182 MacroAssembler(Isolate* isolate, byte* buffer, unsigned buffer_size, |
168 CodeObjectRequired create_code_object); | 183 CodeObjectRequired create_code_object); |
169 | 184 |
170 Isolate* isolate() const { return isolate_; } | 185 Isolate* isolate() const { return isolate_; } |
171 | 186 |
172 Handle<Object> CodeObject() { | 187 Handle<Object> CodeObject() { |
173 DCHECK(!code_object_.is_null()); | 188 DCHECK(!code_object_.is_null()); |
174 return code_object_; | 189 return code_object_; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // Try to move an immediate into the destination register in a single | 284 // Try to move an immediate into the destination register in a single |
270 // instruction. Returns true for success, and updates the contents of dst. | 285 // instruction. Returns true for success, and updates the contents of dst. |
271 // Returns false, otherwise. | 286 // Returns false, otherwise. |
272 bool TryOneInstrMoveImmediate(const Register& dst, int64_t imm); | 287 bool TryOneInstrMoveImmediate(const Register& dst, int64_t imm); |
273 | 288 |
274 // Move an immediate into register dst, and return an Operand object for use | 289 // Move an immediate into register dst, and return an Operand object for use |
275 // with a subsequent instruction that accepts a shift. The value moved into | 290 // with a subsequent instruction that accepts a shift. The value moved into |
276 // dst is not necessarily equal to imm; it may have had a shifting operation | 291 // dst is not necessarily equal to imm; it may have had a shifting operation |
277 // applied to it that will be subsequently undone by the shift applied in the | 292 // applied to it that will be subsequently undone by the shift applied in the |
278 // Operand. | 293 // Operand. |
279 Operand MoveImmediateForShiftedOp(const Register& dst, int64_t imm); | 294 Operand MoveImmediateForShiftedOp(const Register& dst, int64_t imm, |
| 295 PreShiftImmMode mode); |
280 | 296 |
281 // Conditional macros. | 297 // Conditional macros. |
282 inline void Ccmp(const Register& rn, | 298 inline void Ccmp(const Register& rn, |
283 const Operand& operand, | 299 const Operand& operand, |
284 StatusFlags nzcv, | 300 StatusFlags nzcv, |
285 Condition cond); | 301 Condition cond); |
286 inline void Ccmn(const Register& rn, | 302 inline void Ccmn(const Register& rn, |
287 const Operand& operand, | 303 const Operand& operand, |
288 StatusFlags nzcv, | 304 StatusFlags nzcv, |
289 Condition cond); | 305 Condition cond); |
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2697 class RegisterBits : public BitField<unsigned, 0, 5> {}; | 2713 class RegisterBits : public BitField<unsigned, 0, 5> {}; |
2698 class DeltaBits : public BitField<uint32_t, 5, 32-5> {}; | 2714 class DeltaBits : public BitField<uint32_t, 5, 32-5> {}; |
2699 }; | 2715 }; |
2700 | 2716 |
2701 } // namespace internal | 2717 } // namespace internal |
2702 } // namespace v8 | 2718 } // namespace v8 |
2703 | 2719 |
2704 #define ACCESS_MASM(masm) masm-> | 2720 #define ACCESS_MASM(masm) masm-> |
2705 | 2721 |
2706 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ | 2722 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ |
OLD | NEW |