5 #ifndef INCLUDED_FROM_MACRO_ASSEMBLER_H 6 #error This header must be included via macro-assembler.h 9 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ 10 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_H_ 14 #include "src/arm64/assembler-arm64.h" 15 #include "src/bailout-reason.h" 16 #include "src/base/bits.h" 17 #include "src/globals.h" 23 #define ASM_UNIMPLEMENTED(message) \ 24 __ Debug(message, __LINE__, NO_PARAM) 25 #define ASM_UNIMPLEMENTED_BREAK(message) \ 26 __ Debug(message, __LINE__, \ 27 FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK) 29 #define ASM_LOCATION(message) __ Debug("LOCATION: " message, __LINE__, NO_PARAM) 30 #define ASM_LOCATION_IN_ASSEMBLER(message) \ 31 Debug("LOCATION: " message, __LINE__, NO_PARAM) 33 #define ASM_LOCATION(message) 34 #define ASM_LOCATION_IN_ASSEMBLER(message) 37 #define ASM_UNIMPLEMENTED(message) 38 #define ASM_UNIMPLEMENTED_BREAK(message) 39 #define ASM_LOCATION(message) 40 #define ASM_LOCATION_IN_ASSEMBLER(message) 48 constexpr Register kReturnRegister0 = x0;
49 constexpr Register kReturnRegister1 = x1;
50 constexpr Register kReturnRegister2 = x2;
51 constexpr Register kJSFunctionRegister = x1;
52 constexpr Register kContextRegister = cp;
53 constexpr Register kAllocateSizeRegister = x1;
55 #if defined(V8_OS_WIN) 57 constexpr Register kSpeculationPoisonRegister = x23;
59 constexpr Register kSpeculationPoisonRegister = x18;
62 constexpr Register kInterpreterAccumulatorRegister = x0;
63 constexpr Register kInterpreterBytecodeOffsetRegister = x19;
64 constexpr Register kInterpreterBytecodeArrayRegister = x20;
65 constexpr Register kInterpreterDispatchTableRegister = x21;
67 constexpr Register kJavaScriptCallArgCountRegister = x0;
68 constexpr Register kJavaScriptCallCodeStartRegister = x2;
69 constexpr Register kJavaScriptCallTargetRegister = kJSFunctionRegister;
70 constexpr Register kJavaScriptCallNewTargetRegister = x3;
71 constexpr Register kJavaScriptCallExtraArg1Register = x2;
73 constexpr Register kOffHeapTrampolineRegister = ip0;
74 constexpr Register kRuntimeCallFunctionRegister = x1;
75 constexpr Register kRuntimeCallArgCountRegister = x0;
76 constexpr Register kRuntimeCallArgvRegister = x11;
77 constexpr Register kWasmInstanceRegister = x7;
78 constexpr Register kWasmCompileLazyFuncIndexRegister = x8;
80 #define LS_MACRO_LIST(V) \ 81 V(Ldrb, Register&, rt, LDRB_w) \ 82 V(Strb, Register&, rt, STRB_w) \ 83 V(Ldrsb, Register&, rt, rt.Is64Bits() ? LDRSB_x : LDRSB_w) \ 84 V(Ldrh, Register&, rt, LDRH_w) \ 85 V(Strh, Register&, rt, STRH_w) \ 86 V(Ldrsh, Register&, rt, rt.Is64Bits() ? LDRSH_x : LDRSH_w) \ 87 V(Ldr, CPURegister&, rt, LoadOpFor(rt)) \ 88 V(Str, CPURegister&, rt, StoreOpFor(rt)) \ 89 V(Ldrsw, Register&, rt, LDRSW_x) 91 #define LSPAIR_MACRO_LIST(V) \ 92 V(Ldp, CPURegister&, rt, rt2, LoadPairOpFor(rt, rt2)) \ 93 V(Stp, CPURegister&, rt, rt2, StorePairOpFor(rt, rt2)) \ 94 V(Ldpsw, CPURegister&, rt, rt2, LDPSW_x) 96 #define LDA_STL_MACRO_LIST(V) \ 107 #define STLX_MACRO_LIST(V) \ 116 inline MemOperand FieldMemOperand(Register
object,
int offset);
148 reg_zero, reg_not_zero,
150 reg_bit_clear, reg_bit_set,
153 kBranchTypeFirstCondition = eq,
154 kBranchTypeLastCondition = nv,
155 kBranchTypeFirstUsingReg = reg_zero,
156 kBranchTypeFirstUsingBit = reg_bit_clear
159 inline BranchType InvertBranchType(BranchType type) {
160 if (kBranchTypeFirstCondition <= type && type <= kBranchTypeLastCondition) {
161 return static_cast<BranchType
>(
162 NegateCondition(static_cast<Condition>(type)));
164 return static_cast<BranchType
>(type ^ 1);
168 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET };
169 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK };
170 enum LinkRegisterStatus { kLRHasNotBeenSaved, kLRHasBeenSaved };
171 enum TargetAddressStorageMode {
172 CAN_INLINE_TARGET_ADDRESS,
173 NEVER_INLINE_TARGET_ADDRESS
175 enum DiscardMoveMode { kDontDiscardForSameWReg, kDiscardForSameWReg };
186 enum PreShiftImmMode {
192 class V8_EXPORT_PRIVATE TurboAssembler :
public TurboAssemblerBase {
194 TurboAssembler(
const AssemblerOptions& options,
void* buffer,
int buffer_size)
195 : TurboAssemblerBase(options, buffer, buffer_size) {}
197 TurboAssembler(Isolate* isolate,
const AssemblerOptions& options,
198 void* buffer,
int buffer_size,
199 CodeObjectRequired create_code_object)
200 : TurboAssemblerBase(isolate, options, buffer, buffer_size,
201 create_code_object) {}
204 void set_allow_macro_instructions(
bool value) {
205 allow_macro_instructions_ = value;
207 bool allow_macro_instructions()
const {
return allow_macro_instructions_; }
212 bool CanUseNearCallOrJump(RelocInfo::Mode rmode) {
213 return rmode != RelocInfo::EXTERNAL_REFERENCE;
216 static bool IsNearCallOffset(
int64_t offset);
219 void EnterFrame(StackFrame::Type type);
220 void EnterFrame(StackFrame::Type type,
bool load_constant_pool_pointer_reg) {
224 void LeaveFrame(StackFrame::Type type);
226 inline void InitializeRootRegister();
228 void Mov(
const Register& rd,
const Operand& operand,
229 DiscardMoveMode discard_mode = kDontDiscardForSameWReg);
230 void Mov(
const Register& rd, uint64_t imm);
231 void Mov(
const VRegister& vd,
int vd_index,
const VRegister& vn,
233 DCHECK(allow_macro_instructions());
234 mov(vd, vd_index, vn, vn_index);
236 void Mov(
const VRegister& vd,
const VRegister& vn,
int index) {
237 DCHECK(allow_macro_instructions());
240 void Mov(
const VRegister& vd,
int vd_index,
const Register& rn) {
241 DCHECK(allow_macro_instructions());
242 mov(vd, vd_index, rn);
244 void Mov(
const Register& rd,
const VRegister& vn,
int vn_index) {
245 DCHECK(allow_macro_instructions());
246 mov(rd, vn, vn_index);
251 void Move(Register dst, Smi src);
254 void Swap(Register lhs, Register rhs);
255 void Swap(VRegister lhs, VRegister rhs);
258 #define NEON_BYELEMENT_MACRO_LIST(V) \ 266 V(sqdmulh, Sqdmulh) \ 267 V(sqrdmulh, Sqrdmulh) \ 268 V(sqdmull, Sqdmull) \ 269 V(sqdmull2, Sqdmull2) \ 270 V(sqdmlal, Sqdmlal) \ 271 V(sqdmlal2, Sqdmlal2) \ 272 V(sqdmlsl, Sqdmlsl) \ 273 V(sqdmlsl2, Sqdmlsl2) \ 287 #define DEFINE_MACRO_ASM_FUNC(ASM, MASM) \ 288 void MASM(const VRegister& vd, const VRegister& vn, const VRegister& vm, \ 290 DCHECK(allow_macro_instructions()); \ 291 ASM(vd, vn, vm, vm_index); \ 293 NEON_BYELEMENT_MACRO_LIST(DEFINE_MACRO_ASM_FUNC)
294 #undef DEFINE_MACRO_ASM_FUNC 297 #define NEON_2VREG_MACRO_LIST(V) \ 313 V(fmaxnmp, Fmaxnmp) \ 314 V(fmaxnmv, Fmaxnmv) \ 317 V(fminnmp, Fminnmp) \ 318 V(fminnmv, Fminnmv) \ 331 V(frsqrte, Frsqrte) \ 350 V(sqxtun2, Sqxtun2) \ 363 V(ursqrte, Ursqrte) \ 370 #define DEFINE_MACRO_ASM_FUNC(ASM, MASM) \ 371 void MASM(const VRegister& vd, const VRegister& vn) { \ 372 DCHECK(allow_macro_instructions()); \ 375 NEON_2VREG_MACRO_LIST(DEFINE_MACRO_ASM_FUNC)
376 #undef DEFINE_MACRO_ASM_FUNC 377 #undef NEON_2VREG_MACRO_LIST 380 #define NEON_2VREG_FPIMM_MACRO_LIST(V) \ 387 #define DEFINE_MACRO_ASM_FUNC(ASM, MASM) \ 388 void MASM(const VRegister& vd, const VRegister& vn, double imm) { \ 389 DCHECK(allow_macro_instructions()); \ 392 NEON_2VREG_FPIMM_MACRO_LIST(DEFINE_MACRO_ASM_FUNC)
393 #undef DEFINE_MACRO_ASM_FUNC 396 #define NEON_3VREG_MACRO_LIST(V) \ 420 V(fmaxnmp, Fmaxnmp) \ 422 V(fminnmp, Fminnmp) \ 428 V(frsqrts, Frsqrts) \ 437 V(raddhn2, Raddhn2) \ 439 V(rsubhn2, Rsubhn2) \ 464 V(sqdmlal2, Sqdmlal2) \ 465 V(sqdmlal, Sqdmlal) \ 466 V(sqdmlsl2, Sqdmlsl2) \ 467 V(sqdmlsl, Sqdmlsl) \ 468 V(sqdmulh, Sqdmulh) \ 469 V(sqdmull2, Sqdmull2) \ 470 V(sqdmull, Sqdmull) \ 471 V(sqrdmulh, Sqrdmulh) \ 525 #define DEFINE_MACRO_ASM_FUNC(ASM, MASM) \ 526 void MASM(const VRegister& vd, const VRegister& vn, const VRegister& vm) { \ 527 DCHECK(allow_macro_instructions()); \ 530 NEON_3VREG_MACRO_LIST(DEFINE_MACRO_ASM_FUNC)
531 #undef DEFINE_MACRO_ASM_FUNC 533 void Bic(
const VRegister& vd,
const int imm8,
const int left_shift = 0) {
534 DCHECK(allow_macro_instructions());
535 bic(vd, imm8, left_shift);
539 inline void jmp(Label* L);
541 void B(Label* label, BranchType type, Register reg = NoReg,
int bit = -1);
542 inline void B(Label* label);
543 inline void B(Condition cond, Label* label);
544 void B(Label* label, Condition cond);
546 void Tbnz(
const Register& rt,
unsigned bit_pos, Label* label);
547 void Tbz(
const Register& rt,
unsigned bit_pos, Label* label);
549 void Cbnz(
const Register& rt, Label* label);
550 void Cbz(
const Register& rt, Label* label);
552 inline void Dmb(BarrierDomain domain, BarrierType type);
553 inline void Dsb(BarrierDomain domain, BarrierType type);
557 bool AllowThisStubCall(CodeStub* stub);
561 void CallRuntimeWithCEntry(Runtime::FunctionId fid, Register centry);
568 void PrepareForTailCall(
const ParameterCount& callee_args_count,
569 Register caller_args_count_reg, Register scratch0,
572 inline void SmiUntag(Register dst, Register src);
573 inline void SmiUntag(Register dst,
const MemOperand& src);
574 inline void SmiUntag(Register smi);
578 void Assert(Condition cond, AbortReason reason);
582 void AssertUnreachable(AbortReason reason);
584 void AssertSmi(Register
object,
585 AbortReason reason = AbortReason::kOperandIsNotASmi);
588 void Check(Condition cond, AbortReason reason);
590 inline void Debug(
const char* message,
uint32_t code, Instr params = BREAK);
593 void Abort(AbortReason reason);
596 inline void Asr(
const Register& rd,
const Register& rn,
unsigned shift);
597 inline void Asr(
const Register& rd,
const Register& rn,
const Register& rm);
602 bool TryOneInstrMoveImmediate(
const Register& dst,
int64_t imm);
604 inline void Bind(Label* label);
606 static unsigned CountClearHalfWords(uint64_t imm,
unsigned reg_size);
608 CPURegList* TmpList() {
return &tmp_list_; }
609 CPURegList* FPTmpList() {
return &fptmp_list_; }
611 static CPURegList DefaultTmpList();
612 static CPURegList DefaultFPTmpList();
615 inline void Mvn(
const Register& rd, uint64_t imm);
616 void Mvn(
const Register& rd,
const Operand& operand);
617 static bool IsImmMovn(uint64_t imm,
unsigned reg_size);
618 static bool IsImmMovz(uint64_t imm,
unsigned reg_size);
620 void LogicalMacro(
const Register& rd,
const Register& rn,
621 const Operand& operand, LogicalOp op);
622 void AddSubMacro(
const Register& rd,
const Register& rn,
623 const Operand& operand, FlagsUpdate S, AddSubOp op);
624 inline void Orr(
const Register& rd,
const Register& rn,
625 const Operand& operand);
626 void Orr(
const VRegister& vd,
const int imm8,
const int left_shift = 0) {
627 DCHECK(allow_macro_instructions());
628 orr(vd, imm8, left_shift);
630 inline void Orn(
const Register& rd,
const Register& rn,
631 const Operand& operand);
632 inline void Eor(
const Register& rd,
const Register& rn,
633 const Operand& operand);
634 inline void Eon(
const Register& rd,
const Register& rn,
635 const Operand& operand);
636 inline void And(
const Register& rd,
const Register& rn,
637 const Operand& operand);
638 inline void Ands(
const Register& rd,
const Register& rn,
639 const Operand& operand);
640 inline void Tst(
const Register& rn,
const Operand& operand);
641 inline void Bic(
const Register& rd,
const Register& rn,
642 const Operand& operand);
643 inline void Blr(
const Register& xn);
644 inline void Cmp(
const Register& rn,
const Operand& operand);
645 inline void Subs(
const Register& rd,
const Register& rn,
646 const Operand& operand);
647 void Csel(
const Register& rd,
const Register& rn,
const Operand& operand,
651 void AssertSpAligned();
659 void CopySlots(
int dst, Register src, Register slot_count);
660 void CopySlots(Register dst, Register src, Register slot_count);
674 enum CopyDoubleWordsMode { kDstLessThanSrc, kSrcLessThanDst };
675 void CopyDoubleWords(Register dst, Register src, Register count,
676 CopyDoubleWordsMode mode = kDstLessThanSrc);
681 void SlotAddress(Register dst,
int slot_offset);
682 void SlotAddress(Register dst, Register slot_offset);
685 inline void Ldr(
const CPURegister& rt,
const Operand& imm);
697 inline void Claim(
int64_t count, uint64_t unit_size = kXRegSize);
698 inline void Claim(
const Register& count, uint64_t unit_size = kXRegSize);
699 inline void Drop(
int64_t count, uint64_t unit_size = kXRegSize);
700 inline void Drop(
const Register& count, uint64_t unit_size = kXRegSize);
707 enum ArgumentsCountMode { kCountIncludesReceiver, kCountExcludesReceiver };
708 inline void DropArguments(
const Register& count,
709 ArgumentsCountMode mode = kCountIncludesReceiver);
710 inline void DropArguments(
int64_t count,
711 ArgumentsCountMode mode = kCountIncludesReceiver);
715 inline void DropSlots(
int64_t count);
718 inline void PushArgument(
const Register& arg);
721 inline void Add(
const Register& rd,
const Register& rn,
722 const Operand& operand);
723 inline void Adds(
const Register& rd,
const Register& rn,
724 const Operand& operand);
725 inline void Sub(
const Register& rd,
const Register& rn,
726 const Operand& operand);
730 void AssertPositiveOrZero(Register value);
732 #define DECLARE_FUNCTION(FN, REGTYPE, REG, OP) \ 733 inline void FN(const REGTYPE REG, const MemOperand& addr); 734 LS_MACRO_LIST(DECLARE_FUNCTION)
735 #undef DECLARE_FUNCTION 756 void Push(
const CPURegister& src0,
const CPURegister& src1 = NoReg,
757 const CPURegister& src2 = NoReg,
const CPURegister& src3 = NoReg);
758 void Push(
const CPURegister& src0,
const CPURegister& src1,
759 const CPURegister& src2,
const CPURegister& src3,
760 const CPURegister& src4,
const CPURegister& src5 = NoReg,
761 const CPURegister& src6 = NoReg,
const CPURegister& src7 = NoReg);
762 void Pop(
const CPURegister& dst0,
const CPURegister& dst1 = NoReg,
763 const CPURegister& dst2 = NoReg,
const CPURegister& dst3 = NoReg);
764 void Pop(
const CPURegister& dst0,
const CPURegister& dst1,
765 const CPURegister& dst2,
const CPURegister& dst3,
766 const CPURegister& dst4,
const CPURegister& dst5 = NoReg,
767 const CPURegister& dst6 = NoReg,
const CPURegister& dst7 = NoReg);
768 void Push(
const Register& src0,
const VRegister& src1);
771 inline void Push(Handle<HeapObject>
object);
772 inline void Push(Smi smi);
775 inline void push(Register src) { Push(src); }
776 inline void pop(Register dst) { Pop(dst); }
778 void SaveRegisters(RegList registers);
779 void RestoreRegisters(RegList registers);
781 void CallRecordWriteStub(Register
object, Register address,
782 RememberedSetAction remembered_set_action,
783 SaveFPRegsMode fp_mode);
784 void CallRecordWriteStub(Register
object, Register address,
785 RememberedSetAction remembered_set_action,
786 SaveFPRegsMode fp_mode, Address wasm_target);
798 void PushCPURegList(CPURegList registers);
799 void PopCPURegList(CPURegList registers);
803 int RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
804 Register exclusion)
const;
808 int PushCallerSaved(SaveFPRegsMode fp_mode, Register exclusion = no_reg);
812 int PopCallerSaved(SaveFPRegsMode fp_mode, Register exclusion = no_reg);
819 Operand MoveImmediateForShiftedOp(
const Register& dst,
int64_t imm,
820 PreShiftImmMode mode);
822 void CheckPageFlagSet(
const Register&
object,
const Register& scratch,
823 int mask, Label* if_any_set);
825 void CheckPageFlagClear(
const Register&
object,
const Register& scratch,
826 int mask, Label* if_all_clear);
830 inline void TestAndBranchIfAnySet(
const Register& reg,
831 const uint64_t bit_pattern, Label* label);
835 inline void TestAndBranchIfAllClear(
const Register& reg,
836 const uint64_t bit_pattern, Label* label);
838 inline void Brk(
int code);
840 inline void JumpIfSmi(Register value, Label* smi_label,
841 Label* not_smi_label =
nullptr);
843 inline void JumpIfEqual(Register x, int32_t y, Label* dest);
844 inline void JumpIfLessThan(Register x, int32_t y, Label* dest);
846 inline void Fmov(VRegister fd, VRegister fn);
847 inline void Fmov(VRegister fd, Register rn);
852 inline void Fmov(VRegister fd,
double imm);
853 inline void Fmov(VRegister fd,
float imm);
855 template <
typename T>
856 void Fmov(VRegister fd, T imm) {
857 DCHECK(allow_macro_instructions());
858 Fmov(fd, static_cast<double>(imm));
860 inline void Fmov(Register rd, VRegister fn);
862 void Movi(
const VRegister& vd, uint64_t imm, Shift shift = LSL,
863 int shift_amount = 0);
864 void Movi(
const VRegister& vd, uint64_t hi, uint64_t lo);
866 void LoadFromConstantsTable(Register destination,
867 int constant_index)
override;
868 void LoadRootRegisterOffset(Register destination, intptr_t offset)
override;
869 void LoadRootRelative(Register destination, int32_t offset)
override;
871 void Jump(Register target, Condition cond = al);
872 void Jump(Address target, RelocInfo::Mode rmode, Condition cond = al);
873 void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al);
875 void Call(Register target);
876 void Call(Address target, RelocInfo::Mode rmode);
877 void Call(Handle<Code> code, RelocInfo::Mode rmode = RelocInfo::CODE_TARGET);
878 void Call(ExternalReference target);
881 void IndirectCall(Address target, RelocInfo::Mode rmode);
883 void CallForDeoptimization(Address target,
int deopt_id,
884 RelocInfo::Mode rmode);
891 void CallCFunction(ExternalReference
function,
int num_reg_arguments);
892 void CallCFunction(ExternalReference
function,
int num_reg_arguments,
893 int num_double_arguments);
894 void CallCFunction(Register
function,
int num_reg_arguments,
895 int num_double_arguments);
900 void TruncateDoubleToI(Isolate* isolate, Zone* zone, Register result,
901 DoubleRegister double_input, StubCallMode stub_mode);
903 inline void Mul(
const Register& rd,
const Register& rn,
const Register& rm);
905 inline void Fcvtzs(
const Register& rd,
const VRegister& fn);
906 void Fcvtzs(
const VRegister& vd,
const VRegister& vn,
int fbits = 0) {
907 DCHECK(allow_macro_instructions());
908 fcvtzs(vd, vn, fbits);
911 inline void Fcvtzu(
const Register& rd,
const VRegister& fn);
912 void Fcvtzu(
const VRegister& vd,
const VRegister& vn,
int fbits = 0) {
913 DCHECK(allow_macro_instructions());
914 fcvtzu(vd, vn, fbits);
917 inline void Madd(
const Register& rd,
const Register& rn,
const Register& rm,
919 inline void Mneg(
const Register& rd,
const Register& rn,
const Register& rm);
920 inline void Sdiv(
const Register& rd,
const Register& rn,
const Register& rm);
921 inline void Udiv(
const Register& rd,
const Register& rn,
const Register& rm);
922 inline void Msub(
const Register& rd,
const Register& rn,
const Register& rm,
925 inline void Lsl(
const Register& rd,
const Register& rn,
unsigned shift);
926 inline void Lsl(
const Register& rd,
const Register& rn,
const Register& rm);
927 inline void Umull(
const Register& rd,
const Register& rn,
const Register& rm);
928 inline void Smull(
const Register& rd,
const Register& rn,
const Register& rm);
930 inline void Sxtb(
const Register& rd,
const Register& rn);
931 inline void Sxth(
const Register& rd,
const Register& rn);
932 inline void Sxtw(
const Register& rd,
const Register& rn);
933 inline void Ubfiz(
const Register& rd,
const Register& rn,
unsigned lsb,
935 inline void Ubfx(
const Register& rd,
const Register& rn,
unsigned lsb,
937 inline void Lsr(
const Register& rd,
const Register& rn,
unsigned shift);
938 inline void Lsr(
const Register& rd,
const Register& rn,
const Register& rm);
939 inline void Ror(
const Register& rd,
const Register& rs,
unsigned shift);
940 inline void Ror(
const Register& rd,
const Register& rn,
const Register& rm);
941 inline void Cmn(
const Register& rn,
const Operand& operand);
942 inline void Fadd(
const VRegister& fd,
const VRegister& fn,
943 const VRegister& fm);
944 inline void Fcmp(
const VRegister& fn,
const VRegister& fm);
945 inline void Fcmp(
const VRegister& fn,
double value);
946 inline void Fabs(
const VRegister& fd,
const VRegister& fn);
947 inline void Fmul(
const VRegister& fd,
const VRegister& fn,
948 const VRegister& fm);
949 inline void Fsub(
const VRegister& fd,
const VRegister& fn,
950 const VRegister& fm);
951 inline void Fdiv(
const VRegister& fd,
const VRegister& fn,
952 const VRegister& fm);
953 inline void Fmax(
const VRegister& fd,
const VRegister& fn,
954 const VRegister& fm);
955 inline void Fmin(
const VRegister& fd,
const VRegister& fn,
956 const VRegister& fm);
957 inline void Rbit(
const Register& rd,
const Register& rn);
958 inline void Rev(
const Register& rd,
const Register& rn);
967 void Adr(
const Register& rd, Label* label, AdrHint = kAdrNear);
970 inline void Adc(
const Register& rd,
const Register& rn,
971 const Operand& operand);
974 inline void Ccmp(
const Register& rn,
const Operand& operand, StatusFlags nzcv,
977 inline void Clz(
const Register& rd,
const Register& rn);
981 void Poke(
const CPURegister& src,
const Operand& offset);
985 void Peek(
const CPURegister& dst,
const Operand& offset);
990 void PokePair(
const CPURegister& src1,
const CPURegister& src2,
int offset);
992 inline void Sbfx(
const Register& rd,
const Register& rn,
unsigned lsb,
995 inline void Bfi(
const Register& rd,
const Register& rn,
unsigned lsb,
998 inline void Scvtf(
const VRegister& fd,
const Register& rn,
1000 void Scvtf(
const VRegister& vd,
const VRegister& vn,
int fbits = 0) {
1001 DCHECK(allow_macro_instructions());
1002 scvtf(vd, vn, fbits);
1004 inline void Ucvtf(
const VRegister& fd,
const Register& rn,
1005 unsigned fbits = 0);
1006 void Ucvtf(
const VRegister& vd,
const VRegister& vn,
int fbits = 0) {
1007 DCHECK(allow_macro_instructions());
1008 ucvtf(vd, vn, fbits);
1011 void AssertFPCRState(Register fpcr = NoReg);
1012 void CanonicalizeNaN(
const VRegister& dst,
const VRegister& src);
1013 void CanonicalizeNaN(
const VRegister& reg) { CanonicalizeNaN(reg, reg); }
1015 inline void CmovX(
const Register& rd,
const Register& rn, Condition cond);
1016 inline void Cset(
const Register& rd, Condition cond);
1017 inline void Csetm(
const Register& rd, Condition cond);
1018 inline void Fccmp(
const VRegister& fn,
const VRegister& fm, StatusFlags nzcv,
1020 inline void Csinc(
const Register& rd,
const Register& rn,
const Register& rm,
1023 inline void Fcvt(
const VRegister& fd,
const VRegister& fn);
1025 int ActivationFrameAlignment();
1027 void Ins(
const VRegister& vd,
int vd_index,
const VRegister& vn,
1029 DCHECK(allow_macro_instructions());
1030 ins(vd, vd_index, vn, vn_index);
1032 void Ins(
const VRegister& vd,
int vd_index,
const Register& rn) {
1033 DCHECK(allow_macro_instructions());
1034 ins(vd, vd_index, rn);
1037 inline void Bl(Label* label);
1038 inline void Br(
const Register& xn);
1040 inline void Uxtb(
const Register& rd,
const Register& rn);
1041 inline void Uxth(
const Register& rd,
const Register& rn);
1042 inline void Uxtw(
const Register& rd,
const Register& rn);
1044 void Dup(
const VRegister& vd,
const VRegister& vn,
int index) {
1045 DCHECK(allow_macro_instructions());
1048 void Dup(
const VRegister& vd,
const Register& rn) {
1049 DCHECK(allow_macro_instructions());
1053 #define DECLARE_FUNCTION(FN, REGTYPE, REG, REG2, OP) \ 1054 inline void FN(const REGTYPE REG, const REGTYPE REG2, const MemOperand& addr); 1055 LSPAIR_MACRO_LIST(DECLARE_FUNCTION)
1056 #undef DECLARE_FUNCTION 1058 #define NEON_2VREG_SHIFT_MACRO_LIST(V) \ 1067 V(sqrshrn, Sqrshrn) \ 1068 V(sqrshrn2, Sqrshrn2) \ 1069 V(sqrshrun, Sqrshrun) \ 1070 V(sqrshrun2, Sqrshrun2) \ 1074 V(sqshrn2, Sqshrn2) \ 1075 V(sqshrun, Sqshrun) \ 1076 V(sqshrun2, Sqshrun2) \ 1084 V(uqrshrn, Uqrshrn) \ 1085 V(uqrshrn2, Uqrshrn2) \ 1088 V(uqshrn2, Uqshrn2) \ 1096 #define DEFINE_MACRO_ASM_FUNC(ASM, MASM) \ 1097 void MASM(const VRegister& vd, const VRegister& vn, int shift) { \ 1098 DCHECK(allow_macro_instructions()); \ 1099 ASM(vd, vn, shift); \ 1101 NEON_2VREG_SHIFT_MACRO_LIST(DEFINE_MACRO_ASM_FUNC)
1102 #undef DEFINE_MACRO_ASM_FUNC 1104 void Umov(
const Register& rd,
const VRegister& vn,
int vn_index) {
1105 DCHECK(allow_macro_instructions());
1106 umov(rd, vn, vn_index);
1108 void Tbl(
const VRegister& vd,
const VRegister& vn,
const VRegister& vm) {
1109 DCHECK(allow_macro_instructions());
1112 void Tbl(
const VRegister& vd,
const VRegister& vn,
const VRegister& vn2,
1113 const VRegister& vm) {
1114 DCHECK(allow_macro_instructions());
1115 tbl(vd, vn, vn2, vm);
1117 void Tbl(
const VRegister& vd,
const VRegister& vn,
const VRegister& vn2,
1118 const VRegister& vn3,
const VRegister& vm) {
1119 DCHECK(allow_macro_instructions());
1120 tbl(vd, vn, vn2, vn3, vm);
1122 void Tbl(
const VRegister& vd,
const VRegister& vn,
const VRegister& vn2,
1123 const VRegister& vn3,
const VRegister& vn4,
const VRegister& vm) {
1124 DCHECK(allow_macro_instructions());
1125 tbl(vd, vn, vn2, vn3, vn4, vm);
1127 void Ext(
const VRegister& vd,
const VRegister& vn,
const VRegister& vm,
1129 DCHECK(allow_macro_instructions());
1130 ext(vd, vn, vm, index);
1133 void Smov(
const Register& rd,
const VRegister& vn,
int vn_index) {
1134 DCHECK(allow_macro_instructions());
1135 smov(rd, vn, vn_index);
1139 #define DECLARE_FUNCTION(FN, OP) \ 1140 inline void FN(const Register& rt, const Register& rn); 1141 LDA_STL_MACRO_LIST(DECLARE_FUNCTION)
1142 #undef DECLARE_FUNCTION 1145 void LoadRoot(Register destination, RootIndex index)
override;
1147 inline void Ret(
const Register& xn = lr);
1158 void TryConvertDoubleToInt64(Register result, DoubleRegister input,
1161 inline void Mrs(
const Register& rt, SystemRegister sysreg);
1166 void Cmgt(
const VRegister& vd,
const VRegister& vn,
int imm) {
1167 DCHECK(allow_macro_instructions());
1170 void Cmge(
const VRegister& vd,
const VRegister& vn,
int imm) {
1171 DCHECK(allow_macro_instructions());
1174 void Cmeq(
const VRegister& vd,
const VRegister& vn,
int imm) {
1175 DCHECK(allow_macro_instructions());
1179 inline void Neg(
const Register& rd,
const Operand& operand);
1180 inline void Negs(
const Register& rd,
const Operand& operand);
1188 void Abs(
const Register& rd,
const Register& rm,
1189 Label* is_not_representable =
nullptr,
1190 Label* is_representable =
nullptr);
1192 inline void Cls(
const Register& rd,
const Register& rn);
1193 inline void Cneg(
const Register& rd,
const Register& rn, Condition cond);
1194 inline void Rev16(
const Register& rd,
const Register& rn);
1195 inline void Rev32(
const Register& rd,
const Register& rn);
1196 inline void Fcvtns(
const Register& rd,
const VRegister& fn);
1197 inline void Fcvtnu(
const Register& rd,
const VRegister& fn);
1198 inline void Fcvtms(
const Register& rd,
const VRegister& fn);
1199 inline void Fcvtmu(
const Register& rd,
const VRegister& fn);
1200 inline void Fcvtas(
const Register& rd,
const VRegister& fn);
1201 inline void Fcvtau(
const Register& rd,
const VRegister& fn);
1205 void ComputeCodeStartAddress(
const Register& rd);
1207 void ResetSpeculationPoisonRegister();
1216 void PushHelper(
int count,
int size,
const CPURegister& src0,
1217 const CPURegister& src1,
const CPURegister& src2,
1218 const CPURegister& src3);
1219 void PopHelper(
int count,
int size,
const CPURegister& dst0,
1220 const CPURegister& dst1,
const CPURegister& dst2,
1221 const CPURegister& dst3);
1223 void ConditionalCompareMacro(
const Register& rn,
const Operand& operand,
1224 StatusFlags nzcv, Condition cond,
1225 ConditionalCompareOp op);
1227 void AddSubWithCarryMacro(
const Register& rd,
const Register& rn,
1228 const Operand& operand, FlagsUpdate S,
1229 AddSubWithCarryOp op);
1239 void CallPrintf(
int arg_count = 0,
const CPURegister* args =
nullptr);
1246 bool allow_macro_instructions_ =
true;
1251 CPURegList tmp_list_ = DefaultTmpList();
1252 CPURegList fptmp_list_ = DefaultFPTmpList();
1262 bool NeedExtraInstructionsOrRegisterBranch(Label* label,
1263 ImmBranchType branch_type);
1265 void Movi16bitHelper(
const VRegister& vd, uint64_t imm);
1266 void Movi32bitHelper(
const VRegister& vd, uint64_t imm);
1267 void Movi64bitHelper(
const VRegister& vd, uint64_t imm);
1269 void LoadStoreMacro(
const CPURegister& rt,
const MemOperand& addr,
1272 void LoadStorePairMacro(
const CPURegister& rt,
const CPURegister& rt2,
1273 const MemOperand& addr, LoadStorePairOp op);
1275 void JumpHelper(
int64_t offset, RelocInfo::Mode rmode, Condition cond = al);
1277 void CallRecordWriteStub(Register
object, Register address,
1278 RememberedSetAction remembered_set_action,
1279 SaveFPRegsMode fp_mode, Handle<Code> code_target,
1280 Address wasm_target);
1283 class MacroAssembler :
public TurboAssembler {
1285 MacroAssembler(
const AssemblerOptions& options,
void* buffer,
int size)
1286 : TurboAssembler(options, buffer, size) {}
1288 MacroAssembler(Isolate* isolate,
void* buffer,
int size,
1289 CodeObjectRequired create_code_object)
1290 : MacroAssembler(isolate, AssemblerOptions::Default(isolate), buffer,
1291 size, create_code_object) {}
1293 MacroAssembler(Isolate* isolate,
const AssemblerOptions& options,
1294 void* buffer,
int size, CodeObjectRequired create_code_object);
1298 inline void Bics(
const Register& rd,
const Register& rn,
1299 const Operand& operand);
1301 inline void Adcs(
const Register& rd,
const Register& rn,
1302 const Operand& operand);
1303 inline void Sbc(
const Register& rd,
const Register& rn,
1304 const Operand& operand);
1305 inline void Sbcs(
const Register& rd,
const Register& rn,
1306 const Operand& operand);
1307 inline void Ngc(
const Register& rd,
const Operand& operand);
1308 inline void Ngcs(
const Register& rd,
const Operand& operand);
1310 inline void Ccmn(
const Register& rn,
const Operand& operand, StatusFlags nzcv,
1313 #define DECLARE_FUNCTION(FN, OP) \ 1314 inline void FN(const Register& rs, const Register& rt, const Register& rn); 1315 STLX_MACRO_LIST(DECLARE_FUNCTION)
1316 #undef DECLARE_FUNCTION 1319 STATIC_ASSERT((reg_zero == (reg_not_zero ^ 1)) &&
1320 (reg_bit_clear == (reg_bit_set ^ 1)) &&
1321 (always == (never ^ 1)));
1323 inline void Bfxil(
const Register& rd,
const Register& rn,
unsigned lsb,
1325 inline void Cinc(
const Register& rd,
const Register& rn, Condition cond);
1326 inline void Cinv(
const Register& rd,
const Register& rn, Condition cond);
1327 inline void CzeroX(
const Register& rd, Condition cond);
1328 inline void Csinv(
const Register& rd,
const Register& rn,
const Register& rm,
1330 inline void Csneg(
const Register& rd,
const Register& rn,
const Register& rm,
1332 inline void Extr(
const Register& rd,
const Register& rn,
const Register& rm,
1334 inline void Fcsel(
const VRegister& fd,
const VRegister& fn,
1335 const VRegister& fm, Condition cond);
1336 void Fcvtl(
const VRegister& vd,
const VRegister& vn) {
1337 DCHECK(allow_macro_instructions());
1340 void Fcvtl2(
const VRegister& vd,
const VRegister& vn) {
1341 DCHECK(allow_macro_instructions());
1344 void Fcvtn(
const VRegister& vd,
const VRegister& vn) {
1345 DCHECK(allow_macro_instructions());
1348 void Fcvtn2(
const VRegister& vd,
const VRegister& vn) {
1349 DCHECK(allow_macro_instructions());
1352 void Fcvtxn(
const VRegister& vd,
const VRegister& vn) {
1353 DCHECK(allow_macro_instructions());
1356 void Fcvtxn2(
const VRegister& vd,
const VRegister& vn) {
1357 DCHECK(allow_macro_instructions());
1360 inline void Fmadd(
const VRegister& fd,
const VRegister& fn,
1361 const VRegister& fm,
const VRegister& fa);
1362 inline void Fmaxnm(
const VRegister& fd,
const VRegister& fn,
1363 const VRegister& fm);
1364 inline void Fminnm(
const VRegister& fd,
const VRegister& fn,
1365 const VRegister& fm);
1366 inline void Fmsub(
const VRegister& fd,
const VRegister& fn,
1367 const VRegister& fm,
const VRegister& fa);
1368 inline void Fnmadd(
const VRegister& fd,
const VRegister& fn,
1369 const VRegister& fm,
const VRegister& fa);
1370 inline void Fnmsub(
const VRegister& fd,
const VRegister& fn,
1371 const VRegister& fm,
const VRegister& fa);
1372 inline void Hint(SystemHint code);
1373 inline void Hlt(
int code);
1374 inline void Ldnp(
const CPURegister& rt,
const CPURegister& rt2,
1375 const MemOperand& src);
1376 inline void Movk(
const Register& rd, uint64_t imm,
int shift = -1);
1377 inline void Msr(SystemRegister sysreg,
const Register& rt);
1378 inline void Nop() { nop(); }
1379 void Mvni(
const VRegister& vd,
const int imm8, Shift shift = LSL,
1380 const int shift_amount = 0) {
1381 DCHECK(allow_macro_instructions());
1382 mvni(vd, imm8, shift, shift_amount);
1384 inline void Rev(
const Register& rd,
const Register& rn);
1385 inline void Sbfiz(
const Register& rd,
const Register& rn,
unsigned lsb,
1387 inline void Smaddl(
const Register& rd,
const Register& rn,
const Register& rm,
1388 const Register& ra);
1389 inline void Smsubl(
const Register& rd,
const Register& rn,
const Register& rm,
1390 const Register& ra);
1391 inline void Smulh(
const Register& rd,
const Register& rn,
const Register& rm);
1392 inline void Stnp(
const CPURegister& rt,
const CPURegister& rt2,
1393 const MemOperand& dst);
1394 inline void Umaddl(
const Register& rd,
const Register& rn,
const Register& rm,
1395 const Register& ra);
1396 inline void Umsubl(
const Register& rd,
const Register& rn,
const Register& rm,
1397 const Register& ra);
1399 void Cmle(
const VRegister& vd,
const VRegister& vn,
int imm) {
1400 DCHECK(allow_macro_instructions());
1403 void Cmlt(
const VRegister& vd,
const VRegister& vn,
int imm) {
1404 DCHECK(allow_macro_instructions());
1408 void Ld1(
const VRegister& vt,
const MemOperand& src) {
1409 DCHECK(allow_macro_instructions());
1412 void Ld1(
const VRegister& vt,
const VRegister& vt2,
const MemOperand& src) {
1413 DCHECK(allow_macro_instructions());
1416 void Ld1(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1417 const MemOperand& src) {
1418 DCHECK(allow_macro_instructions());
1419 ld1(vt, vt2, vt3, src);
1421 void Ld1(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1422 const VRegister& vt4,
const MemOperand& src) {
1423 DCHECK(allow_macro_instructions());
1424 ld1(vt, vt2, vt3, vt4, src);
1426 void Ld1(
const VRegister& vt,
int lane,
const MemOperand& src) {
1427 DCHECK(allow_macro_instructions());
1430 void Ld1r(
const VRegister& vt,
const MemOperand& src) {
1431 DCHECK(allow_macro_instructions());
1434 void Ld2(
const VRegister& vt,
const VRegister& vt2,
const MemOperand& src) {
1435 DCHECK(allow_macro_instructions());
1438 void Ld2(
const VRegister& vt,
const VRegister& vt2,
int lane,
1439 const MemOperand& src) {
1440 DCHECK(allow_macro_instructions());
1441 ld2(vt, vt2, lane, src);
1443 void Ld2r(
const VRegister& vt,
const VRegister& vt2,
const MemOperand& src) {
1444 DCHECK(allow_macro_instructions());
1447 void Ld3(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1448 const MemOperand& src) {
1449 DCHECK(allow_macro_instructions());
1450 ld3(vt, vt2, vt3, src);
1452 void Ld3(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1453 int lane,
const MemOperand& src) {
1454 DCHECK(allow_macro_instructions());
1455 ld3(vt, vt2, vt3, lane, src);
1457 void Ld3r(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1458 const MemOperand& src) {
1459 DCHECK(allow_macro_instructions());
1460 ld3r(vt, vt2, vt3, src);
1462 void Ld4(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1463 const VRegister& vt4,
const MemOperand& src) {
1464 DCHECK(allow_macro_instructions());
1465 ld4(vt, vt2, vt3, vt4, src);
1467 void Ld4(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1468 const VRegister& vt4,
int lane,
const MemOperand& src) {
1469 DCHECK(allow_macro_instructions());
1470 ld4(vt, vt2, vt3, vt4, lane, src);
1472 void Ld4r(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1473 const VRegister& vt4,
const MemOperand& src) {
1474 DCHECK(allow_macro_instructions());
1475 ld4r(vt, vt2, vt3, vt4, src);
1477 void St1(
const VRegister& vt,
const MemOperand& dst) {
1478 DCHECK(allow_macro_instructions());
1481 void St1(
const VRegister& vt,
const VRegister& vt2,
const MemOperand& dst) {
1482 DCHECK(allow_macro_instructions());
1485 void St1(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1486 const MemOperand& dst) {
1487 DCHECK(allow_macro_instructions());
1488 st1(vt, vt2, vt3, dst);
1490 void St1(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1491 const VRegister& vt4,
const MemOperand& dst) {
1492 DCHECK(allow_macro_instructions());
1493 st1(vt, vt2, vt3, vt4, dst);
1495 void St1(
const VRegister& vt,
int lane,
const MemOperand& dst) {
1496 DCHECK(allow_macro_instructions());
1499 void St2(
const VRegister& vt,
const VRegister& vt2,
const MemOperand& dst) {
1500 DCHECK(allow_macro_instructions());
1503 void St3(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1504 const MemOperand& dst) {
1505 DCHECK(allow_macro_instructions());
1506 st3(vt, vt2, vt3, dst);
1508 void St4(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1509 const VRegister& vt4,
const MemOperand& dst) {
1510 DCHECK(allow_macro_instructions());
1511 st4(vt, vt2, vt3, vt4, dst);
1513 void St2(
const VRegister& vt,
const VRegister& vt2,
int lane,
1514 const MemOperand& dst) {
1515 DCHECK(allow_macro_instructions());
1516 st2(vt, vt2, lane, dst);
1518 void St3(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1519 int lane,
const MemOperand& dst) {
1520 DCHECK(allow_macro_instructions());
1521 st3(vt, vt2, vt3, lane, dst);
1523 void St4(
const VRegister& vt,
const VRegister& vt2,
const VRegister& vt3,
1524 const VRegister& vt4,
int lane,
const MemOperand& dst) {
1525 DCHECK(allow_macro_instructions());
1526 st4(vt, vt2, vt3, vt4, lane, dst);
1528 void Tbx(
const VRegister& vd,
const VRegister& vn,
const VRegister& vm) {
1529 DCHECK(allow_macro_instructions());
1532 void Tbx(
const VRegister& vd,
const VRegister& vn,
const VRegister& vn2,
1533 const VRegister& vm) {
1534 DCHECK(allow_macro_instructions());
1535 tbx(vd, vn, vn2, vm);
1537 void Tbx(
const VRegister& vd,
const VRegister& vn,
const VRegister& vn2,
1538 const VRegister& vn3,
const VRegister& vm) {
1539 DCHECK(allow_macro_instructions());
1540 tbx(vd, vn, vn2, vn3, vm);
1542 void Tbx(
const VRegister& vd,
const VRegister& vn,
const VRegister& vn2,
1543 const VRegister& vn3,
const VRegister& vn4,
const VRegister& vm) {
1544 DCHECK(allow_macro_instructions());
1545 tbx(vd, vn, vn2, vn3, vn4, vm);
1548 void LoadObject(Register result, Handle<Object>
object);
1550 inline void PushSizeRegList(RegList registers,
unsigned reg_size,
1551 CPURegister::RegisterType type = CPURegister::kRegister) {
1552 PushCPURegList(CPURegList(type, reg_size, registers));
1554 inline void PopSizeRegList(RegList registers,
unsigned reg_size,
1555 CPURegister::RegisterType type = CPURegister::kRegister) {
1556 PopCPURegList(CPURegList(type, reg_size, registers));
1558 inline void PushXRegList(RegList regs) {
1559 PushSizeRegList(regs, kXRegSizeInBits);
1561 inline void PopXRegList(RegList regs) {
1562 PopSizeRegList(regs, kXRegSizeInBits);
1564 inline void PushWRegList(RegList regs) {
1565 PushSizeRegList(regs, kWRegSizeInBits);
1567 inline void PopWRegList(RegList regs) {
1568 PopSizeRegList(regs, kWRegSizeInBits);
1570 inline void PushDRegList(RegList regs) {
1571 PushSizeRegList(regs, kDRegSizeInBits, CPURegister::kVRegister);
1573 inline void PopDRegList(RegList regs) {
1574 PopSizeRegList(regs, kDRegSizeInBits, CPURegister::kVRegister);
1576 inline void PushSRegList(RegList regs) {
1577 PushSizeRegList(regs, kSRegSizeInBits, CPURegister::kVRegister);
1579 inline void PopSRegList(RegList regs) {
1580 PopSizeRegList(regs, kSRegSizeInBits, CPURegister::kVRegister);
1584 void PushMultipleTimes(CPURegister src, Register count);
1598 DCHECK(queued_.empty());
1602 size_ += rt.SizeInBytes();
1603 queued_.push_back(rt);
1612 std::vector<CPURegister> queued_;
1623 inline void ClaimBySMI(
const Register& count_smi,
1624 uint64_t unit_size = kXRegSize);
1625 inline void DropBySMI(
const Register& count_smi,
1626 uint64_t unit_size = kXRegSize);
1630 inline void CompareAndBranch(
const Register& lhs,
1638 inline void InlineData(uint64_t data);
1641 inline void EnableInstrumentation();
1644 inline void DisableInstrumentation();
1650 inline void AnnotateInstrumentation(
const char* marker_name);
1661 void PushCalleeSavedRegisters();
1669 void PopCalleeSavedRegisters();
1673 static int SafepointRegisterStackIndex(
int reg_code);
1675 template<
typename Field>
1677 static const int shift = Field::kShift;
1678 static const int setbits = CountSetBits(Field::kMask, 32);
1679 Ubfx(dst, src, shift, setbits);
1682 template<
typename Field>
1684 DecodeField<Field>(reg, reg);
1689 inline void SmiTag(Register dst, Register src);
1690 inline void SmiTag(Register smi);
1692 inline void JumpIfNotSmi(Register value, Label* not_smi_label);
1693 inline void JumpIfBothSmi(Register value1, Register value2,
1694 Label* both_smi_label,
1695 Label* not_smi_label =
nullptr);
1696 inline void JumpIfEitherSmi(Register value1, Register value2,
1697 Label* either_smi_label,
1698 Label* not_smi_label =
nullptr);
1699 inline void JumpIfEitherNotSmi(Register value1,
1701 Label* not_smi_label);
1702 inline void JumpIfBothNotSmi(Register value1,
1704 Label* not_smi_label);
1707 void AssertNotSmi(Register
object,
1708 AbortReason reason = AbortReason::kOperandIsASmi);
1710 inline void ObjectTag(Register tagged_obj, Register obj);
1711 inline void ObjectUntag(Register untagged_obj, Register obj);
1714 void AssertConstructor(Register
object);
1717 void AssertFunction(Register
object);
1721 void AssertGeneratorObject(Register
object);
1725 void AssertBoundFunction(Register
object);
1729 void AssertUndefinedOrAllocationSite(Register
object);
1736 void TryRepresentDoubleAsInt64(Register as_int, VRegister value,
1737 VRegister scratch_d,
1738 Label* on_successful_conversion =
nullptr,
1739 Label* on_failed_conversion =
nullptr) {
1740 DCHECK(as_int.Is64Bits());
1741 TryRepresentDoubleAsInt(as_int, value, scratch_d, on_successful_conversion,
1742 on_failed_conversion);
1747 void CallStub(CodeStub* stub);
1748 void TailCallStub(CodeStub* stub);
1750 void CallRuntime(
const Runtime::Function* f,
1752 SaveFPRegsMode save_doubles = kDontSaveFPRegs);
1755 void CallRuntime(Runtime::FunctionId fid,
int num_arguments,
1756 SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
1757 CallRuntime(Runtime::FunctionForId(fid), num_arguments, save_doubles);
1761 void CallRuntime(Runtime::FunctionId fid,
1762 SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
1763 const Runtime::Function*
function = Runtime::FunctionForId(fid);
1764 CallRuntime(
function, function->nargs, save_doubles);
1767 void TailCallRuntime(Runtime::FunctionId fid);
1770 void JumpToExternalReference(
const ExternalReference& builtin,
1771 bool builtin_exit_frame =
false);
1774 void JumpToInstructionStream(Address entry);
1783 void InvokePrologue(
const ParameterCount& expected,
1784 const ParameterCount& actual, Label* done,
1785 InvokeFlag flag,
bool* definitely_mismatches);
1788 void CheckDebugHook(Register fun, Register new_target,
1789 const ParameterCount& expected,
1790 const ParameterCount& actual);
1791 void InvokeFunctionCode(Register
function, Register new_target,
1792 const ParameterCount& expected,
1793 const ParameterCount& actual, InvokeFlag flag);
1796 void InvokeFunction(Register
function, Register new_target,
1797 const ParameterCount& actual, InvokeFlag flag);
1798 void InvokeFunction(Register
function,
const ParameterCount& expected,
1799 const ParameterCount& actual, InvokeFlag flag);
1804 void MaybeDropFrames();
1816 void CompareObjectType(Register heap_object,
1829 void JumpIfObjectType(Register
object,
1833 Label* if_cond_pass,
1834 Condition cond = eq);
1839 void CompareInstanceType(Register map,
1845 void LoadElementsKindFromMap(Register result, Register map);
1848 void CompareRoot(
const Register& obj, RootIndex index);
1851 void JumpIfRoot(
const Register& obj, RootIndex index, Label* if_equal);
1854 void JumpIfNotRoot(
const Register& obj, RootIndex index, Label* if_not_equal);
1858 void CompareAndSplit(
const Register& lhs,
1863 Label* fall_through);
1867 void TestAndSplit(
const Register& reg,
1868 uint64_t bit_pattern,
1869 Label* if_all_clear,
1871 Label* fall_through);
1876 void ExitFramePreserveFPRegs();
1877 void ExitFrameRestoreFPRegs();
1901 void EnterExitFrame(
bool save_doubles,
const Register& scratch,
1902 int extra_space = 0,
1903 StackFrame::Type frame_type = StackFrame::EXIT);
1912 void LeaveExitFrame(
bool save_doubles,
const Register& scratch,
1913 const Register& scratch2);
1916 void LoadGlobalProxy(Register dst);
1920 void LoadWeakValue(Register out, Register in, Label* target_if_cleared);
1925 void IncrementCounter(StatsCounter* counter,
int value, Register scratch1,
1927 void DecrementCounter(StatsCounter* counter,
int value, Register scratch1,
1935 void PushSafepointRegisters();
1936 void PopSafepointRegisters();
1938 void CheckPageFlag(
const Register&
object,
const Register& scratch,
int mask,
1939 Condition cc, Label* condition_met);
1946 void RecordWriteField(
1947 Register
object,
int offset, Register value, Register scratch,
1948 LinkRegisterStatus lr_status, SaveFPRegsMode save_fp,
1949 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
1950 SmiCheck smi_check = INLINE_SMI_CHECK);
1956 Register
object, Register address, Register value,
1957 LinkRegisterStatus lr_status, SaveFPRegsMode save_fp,
1958 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
1959 SmiCheck smi_check = INLINE_SMI_CHECK);
1964 void AssertRegisterIsRoot(
1965 Register reg, RootIndex index,
1966 AbortReason reason = AbortReason::kRegisterDidNotMatchExpectedRoot);
1972 void AssertHasValidColor(
const Register& reg);
1974 void LoadNativeContextSlot(
int index, Register dst);
1991 void Printf(
const char * format,
1992 CPURegister arg0 = NoCPUReg,
1993 CPURegister arg1 = NoCPUReg,
1994 CPURegister arg2 = NoCPUReg,
1995 CPURegister arg3 = NoCPUReg);
2000 void PrintfNoPreserve(
const char * format,
2001 const CPURegister& arg0 = NoCPUReg,
2002 const CPURegister& arg1 = NoCPUReg,
2003 const CPURegister& arg2 = NoCPUReg,
2004 const CPURegister& arg3 = NoCPUReg);
2008 void InNewSpace(Register
object,
2021 void TryRepresentDoubleAsInt(Register as_int, VRegister value,
2022 VRegister scratch_d,
2023 Label* on_successful_conversion =
nullptr,
2024 Label* on_failed_conversion =
nullptr);
2052 size_(count * kInstrSize)
2056 tasm_->CheckConstPool(
false,
true);
2057 tasm_->CheckVeneerPool(
false,
true);
2059 tasm_->StartBlockPools();
2062 tasm_->bind(&start_);
2064 previous_allow_macro_instructions_ = tasm_->allow_macro_instructions();
2065 tasm_->set_allow_macro_instructions(
false);
2070 tasm_->EndBlockPools();
2072 if (start_.is_bound()) {
2073 DCHECK(tasm_->SizeOfCodeGeneratedSince(&start_) == size_);
2075 tasm_->set_allow_macro_instructions(previous_allow_macro_instructions_);
2084 bool previous_allow_macro_instructions_;
2100 : available_(tasm->TmpList()),
2101 availablefp_(tasm->FPTmpList()),
2102 old_available_(available_->list()),
2103 old_availablefp_(availablefp_->list()) {
2104 DCHECK_EQ(available_->type(), CPURegister::kRegister);
2105 DCHECK_EQ(availablefp_->type(), CPURegister::kVRegister);
2108 ~UseScratchRegisterScope();
2112 Register AcquireW() {
return AcquireNextAvailable(available_).W(); }
2113 Register AcquireX() {
return AcquireNextAvailable(available_).X(); }
2114 VRegister AcquireS() {
return AcquireNextAvailable(availablefp_).S(); }
2115 VRegister AcquireD() {
return AcquireNextAvailable(availablefp_).D(); }
2116 VRegister AcquireQ() {
return AcquireNextAvailable(availablefp_).Q(); }
2117 VRegister AcquireV(VectorFormat format) {
2118 return VRegister::Create(AcquireNextAvailable(availablefp_).code(), format);
2121 Register AcquireSameSizeAs(
const Register& reg);
2122 VRegister AcquireSameSizeAs(
const VRegister& reg);
2125 static CPURegister AcquireNextAvailable(CPURegList* available);
2128 CPURegList* available_;
2129 CPURegList* availablefp_;
2132 RegList old_available_;
2133 RegList old_availablefp_;
2136 MemOperand ContextMemOperand(Register context,
int index = 0);
2137 MemOperand NativeContextMemOperand();
2144 bool HasSmiCheck()
const {
return smi_check_ !=
nullptr; }
2146 const Register& SmiRegister()
const {
2154 int SmiCheckDelta()
const {
return smi_check_delta_; }
2163 const Label* smi_check);
2168 Emit(masm, NoReg, &unbound);
2173 int smi_check_delta_;
2184 class RegisterBits :
public BitField<unsigned, 0, 5> {};
2185 class DeltaBits :
public BitField<uint32_t, 5, 32-5> {};
2191 #define ACCESS_MASM(masm) masm-> 2193 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_H_