40 #ifndef V8_ARM_ASSEMBLER_ARM_H_
41 #define V8_ARM_ASSEMBLER_ARM_H_
89 const char*
const names[] = {
211 const char*
const names[] = {
262 *m = (
code_ & 0x10) >> 4;
329 #define kFirstCalleeSavedDoubleReg d8
330 #define kLastCalleeSavedDoubleReg d15
331 #define kDoubleRegZero d14
332 #define kScratchDoubleReg d15
404 return Operand(static_cast<int32_t>(0));
406 INLINE(
explicit Operand(
const ExternalReference& f));
420 INLINE(
bool is_reg()
const);
427 bool is_single_instruction(
const Assembler* assembler,
Instr instr = 0)
const;
428 bool must_output_reloc_info(
const Assembler* assembler)
const;
445 RelocInfo::Mode rmode_;
512 if (f ==
VFP3 && !FLAG_enable_vfp3)
return false;
513 if (f ==
VFP2 && !FLAG_enable_vfp2)
return false;
514 if (f ==
SUDIV && !FLAG_enable_sudiv)
return false;
518 return (supported_ & (1u << f)) != 0;
525 Isolate* isolate = Isolate::UncheckedCurrent();
526 if (isolate ==
NULL) {
531 unsigned enabled =
static_cast<unsigned>(isolate->enabled_cpu_features());
532 return (enabled & (1u << f)) != 0;
542 unsigned mask = 1u << f;
547 (CpuFeatures::found_by_runtime_probing_ & mask) == 0);
548 isolate_ = Isolate::UncheckedCurrent();
550 if (isolate_ !=
NULL) {
551 old_enabled_ =
static_cast<unsigned>(isolate_->enabled_cpu_features());
552 isolate_->set_enabled_cpu_features(old_enabled_ | mask);
556 ASSERT_EQ(Isolate::UncheckedCurrent(), isolate_);
557 if (isolate_ !=
NULL) {
558 isolate_->set_enabled_cpu_features(old_enabled_);
564 unsigned old_enabled_;
577 CpuFeatures::supported_ |= (1u << f);
583 CpuFeatures::supported_ = old_supported_;
588 static bool CanForce() {
595 const unsigned old_supported_;
600 static bool initialized_;
602 static unsigned supported_;
603 static unsigned found_by_runtime_probing_;
605 DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
810 sub(dst, src1, Operand(src2), s, cond);
820 add(dst, src1, Operand(src2), s, cond);
834 tst(src1, Operand(src2), cond);
841 cmp(src1, Operand(src2), cond);
851 orr(dst, src1, Operand(src2), s, cond);
857 mov(dst, Operand(src), s, cond);
961 void stop(
const char* msg,
965 void bkpt(uint32_t imm16);
1171 void nop(
int type = 0);
1282 void db(uint8_t data);
1283 void dd(uint32_t data);
1292 *
reinterpret_cast<Instr*
>(buffer_ + pos) = instr;
1296 *
reinterpret_cast<Instr*
>(
pc) = instr;
1360 if (const_pool_blocked_nesting_++ == 0) {
1370 if (--const_pool_blocked_nesting_ == 0) {
1372 ASSERT((num_pending_reloc_info_ == 0) ||
1379 next_buffer_check_ = no_const_pool_before_;
1384 return (const_pool_blocked_nesting_ > 0) ||
1396 int next_buffer_check_;
1403 static const int kGap = 32;
1420 static const int kCheckPoolIntervalInst = 32;
1421 static const int kCheckPoolInterval = kCheckPoolIntervalInst *
kInstrSize;
1429 static const int kAvgDistToPool =
kMaxDistToPool - kCheckPoolInterval;
1432 int const_pool_blocked_nesting_;
1433 int no_const_pool_before_;
1437 int first_const_pool_use_;
1441 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize;
1442 RelocInfoWriter reloc_info_writer;
1454 int num_pending_reloc_info_;
1457 int last_bound_pos_;
1460 inline void CheckBuffer();
1462 inline void emit(
Instr x);
1465 void move_32_bit_immediate(
Condition cond,
1478 void print(Label*
L);
1479 void bind_to(Label*
L,
int pos);
1480 void link_to(Label*
L, Label* appendix);
1481 void next(Label*
L);
1483 enum UseConstantPoolMode {
1485 DONT_USE_CONSTANT_POOL
1489 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0,
1490 UseConstantPoolMode mode = USE_CONSTANT_POOL);
1499 bool emit_debug_code_;
1500 bool predictable_code_size_;
1510 assembler->CheckBuffer();
1537 #endif // V8_ARM_ASSEMBLER_ARM_H_
void cmp(Register src1, const Operand &src2, Condition cond=al)
static bool IsBranch(Instr instr)
void ldrsb(Register dst, const MemOperand &src, Condition cond=al)
bool ImmediateFitsAddrMode1Instruction(int32_t imm32)
void sdiv(Register dst, Register src1, Register src2, Condition cond=al)
static const int kNumRegisters
void vcvt_f64_u32(const DwVfpRegister dst, const SwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
void mrc(Coprocessor coproc, int opcode_1, Register rd, CRegister crn, CRegister crm, int opcode_2=0, Condition cond=al)
int InstructionsGeneratedSince(Label *label)
static int GetBranchOffset(Instr instr)
void ClearRecordedAstId()
static const int kDebugBreakSlotInstructions
INLINE(static Address target_pointer_address_at(Address pc))
void vcvt_f32_f64(const SwVfpRegister dst, const DwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 instructions(ARM only)") DEFINE_bool(enable_vfp2
static bool IsCmpRegister(Instr instr)
TryForceFeatureScope(CpuFeature f)
const Instr kMovwLeaveCCFlip
void strh(Register src, const MemOperand &dst, Condition cond=al)
void bic(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
void mrs(Register dst, SRegister s, Condition cond=al)
const Instr kLdrPCPattern
const Instr kMovMvnPattern
static void deserialization_set_special_target_at(Address constant_pool_entry, Address target)
static bool IsStrRegFpNegOffset(Instr instr)
void instr_at_put(int pos, Instr instr)
void vabs(const DwVfpRegister dst, const DwVfpRegister src, const Condition cond=al)
const int kRegister_r7_Code
void sbc(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
static bool IsStrRegisterImmediate(Instr instr)
void cmp_raw_immediate(Register src1, int raw_immediate, Condition cond=al)
static TypeFeedbackId None()
void vmov(const DwVfpRegister dst, double imm, const Register scratch=no_reg, const Condition cond=al)
static bool IsMovW(Instr instr)
void pop(Register dst, Condition cond=al)
void mla(Register dst, Register src1, Register src2, Register srcA, SBit s=LeaveCC, Condition cond=al)
const int kRegister_pc_Code
static const int kPatchDebugBreakSlotReturnOffset
int SizeOfCodeGeneratedSince(Label *label)
void bfi(Register dst, Register src, int lsb, int width, Condition cond=al)
static int GetCmpImmediateRawImmediate(Instr instr)
int32_t immediate() const
void push(Register src, Condition cond=al)
void tst(Register src1, Register src2, Condition cond=al)
void b(int branch_offset, Condition cond=al)
void cmn(Register src1, const Operand &src2, Condition cond=al)
void ldrb(Register dst, const MemOperand &src, Condition cond=al)
void smull(Register dstL, Register dstH, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
SwVfpRegister high() const
static const int kNumAllocatableRegisters
static bool IsSupported(CpuFeature f)
void clz(Register dst, Register src, Condition cond=al)
void vmul(const DwVfpRegister dst, const DwVfpRegister src1, const DwVfpRegister src2, const Condition cond=al)
bool predictable_code_size() const
static bool IsStrRegFpOffset(Instr instr)
void vsqrt(const DwVfpRegister dst, const DwVfpRegister src, const Condition cond=al)
void RecordConstPool(int size)
static Register GetRm(Instr instr)
void bl(Label *L, Condition cond=al)
TypeFeedbackId RecordedAstId()
#define ASSERT(condition)
static const int kPatchReturnSequenceAddressOffset
void bl(Condition cond, Label *L)
void svc(uint32_t imm24, Condition cond=al)
static bool IsCmpImmediate(Instr instr)
void SetRecordedAstId(TypeFeedbackId ast_id)
void stm(BlockAddrMode am, Register base, RegList src, Condition cond=al)
static Instr instr_at(byte *pc)
void ldrd(Register dst1, Register dst2, const MemOperand &src, Condition cond=al)
void set_predictable_code_size(bool value)
void ldc2(Coprocessor coproc, CRegister crd, const MemOperand &src, LFlag l=Short)
static void instr_at_put(byte *pc, Instr instr)
static DwVfpRegister from_code(int code)
const Instr kCmpCmnPattern
void blx(int branch_offset)
void target_at_put(int pos, int target_pos)
void vdiv(const DwVfpRegister dst, const DwVfpRegister src1, const DwVfpRegister src2, const Condition cond=al)
const int kRegister_r3_Code
void vcvt_s32_f64(const SwVfpRegister dst, const DwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
bool is(SwVfpRegister reg) const
static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset)
void strb(Register src, const MemOperand &dst, Condition cond=al)
void ldrh(Register dst, const MemOperand &src, Condition cond=al)
void BlockConstPoolFor(int instructions)
static const char * AllocationIndexToString(int index)
bool is(CRegister creg) const
static const int kNumRegisters
EnsureSpace(Assembler *assembler)
void mvn(Register dst, const Operand &src, SBit s=LeaveCC, Condition cond=al)
static Condition GetCondition(Instr instr)
static DwVfpRegister FromAllocationIndex(int index)
void vneg(const DwVfpRegister dst, const DwVfpRegister src, const Condition cond=al)
void vcvt_f64_s32(const DwVfpRegister dst, const SwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
const int kRegister_r2_Code
static bool IsPush(Instr instr)
void vldm(BlockAddrMode am, Register base, DwVfpRegister first, DwVfpRegister last, Condition cond=al)
bool OffsetIsUint12Encodable() const
DwVfpRegister DoubleRegister
PredictableCodeSizeScope(Assembler *assembler)
const int32_t kDefaultStopCode
void vsub(const DwVfpRegister dst, const DwVfpRegister src1, const DwVfpRegister src2, const Condition cond=al)
static const int kSpecialTargetSize
const int kRegister_r5_Code
void GetCode(CodeDesc *desc)
void strd(Register src1, Register src2, const MemOperand &dst, Condition cond=al)
void orr(Register dst, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
static const int kPcLoadDelta
void teq(Register src1, const Operand &src2, Condition cond=al)
int branch_offset(Label *L, bool jump_elimination_allowed)
static void set_target_address_at(Address pc, Address target)
const int kRegister_r4_Code
static bool use_immediate_embedded_pointer_loads(const Assembler *assembler)
void umlal(Register dstL, Register dstH, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
static bool IsPop(Instr instr)
const Instr kMovLeaveCCMask
void movt(Register reg, uint32_t immediate, Condition cond=al)
void cdp2(Coprocessor coproc, int opcode_1, CRegister crd, CRegister crn, CRegister crm, int opcode_2)
static void set_external_target_at(Address constant_pool_entry, Address target)
static Register FromAllocationIndex(int index)
void StartBlockConstPool()
static bool IsMovT(Instr instr)
void vadd(const DwVfpRegister dst, const DwVfpRegister src1, const DwVfpRegister src2, const Condition cond=al)
static Register from_code(int code)
void set_emit_debug_code(bool value)
const int kRegister_r8_Code
void vmrs(const Register dst, const Condition cond=al)
static int ToAllocationIndex(Register reg)
void str(Register src, const MemOperand &dst, Condition cond=al)
void ldm(BlockAddrMode am, Register base, RegList dst, Condition cond=al)
const int kRegister_fp_Code
void split_code(int *vm, int *m) const
void CheckConstPool(bool force_emit, bool require_jump)
void mrc2(Coprocessor coproc, int opcode_1, Register rd, CRegister crn, CRegister crm, int opcode_2=0)
const int kRegister_lr_Code
const DwVfpRegister no_dreg
static Register GetRn(Instr instr)
void mov(Register dst, Register src, SBit s=LeaveCC, Condition cond=al)
void eor(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
void add(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
static Instr SetStrRegisterImmediateOffset(Instr instr, int offset)
void set_offset(int32_t offset)
static const int kDebugBreakSlotLength
static bool IsTstImmediate(Instr instr)
void vcvt_f64_f32(const DwVfpRegister dst, const SwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
static Register GetRd(Instr instr)
static bool IsNop(Instr instr, int type=NON_MARKING_NOP)
static const int kMaxNumPendingRelocInfo
void RecordDebugBreakSlot()
const int kRegister_r10_Code
void vcvt_u32_f64(const SwVfpRegister dst, const DwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
void ldr(Register dst, const MemOperand &src, Condition cond=al)
void stop(const char *msg, Condition cond=al, int32_t code=kDefaultStopCode)
void b(Condition cond, Label *L)
void movw(Register reg, uint32_t immediate, Condition cond=al)
void sub(Register dst, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
bool is(Register reg) const
static Address target_address_at(Address pc)
static Instr SetAddRegisterImmediateOffset(Instr instr, int offset)
const Instr kMovLeaveCCPattern
void smlal(Register dstL, Register dstH, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
const int kRegister_r6_Code
void vldr(const DwVfpRegister dst, const Register base, int offset, const Condition cond=al)
void RecordComment(const char *msg)
void bl(int branch_offset, Condition cond=al)
INLINE(static HeapObject *EnsureDoubleAligned(Heap *heap, HeapObject *object, int size))
static int ToAllocationIndex(DwVfpRegister reg)
void rsb(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
static Register GetCmpImmediateRegister(Instr instr)
void sbfx(Register dst, Register src, int lsb, int width, Condition cond=al)
const Instr kBlxRegPattern
static Address target_address_from_return_address(Address pc)
bool is_const_pool_blocked() const
friend class PositionsRecorder
INLINE(static Operand Zero())
static bool IsAddRegisterImmediate(Instr instr)
void vcmp(const DwVfpRegister src1, const DwVfpRegister src2, const Condition cond=al)
void mov(Register dst, const Operand &src, SBit s=LeaveCC, Condition cond=al)
static const int kNumAllocatableRegisters
void vmsr(const Register dst, const Condition cond=al)
void vstr(const DwVfpRegister src, const Register base, int offset, const Condition cond=al)
Assembler(Isolate *isolate, void *buffer, int buffer_size)
void usat(Register dst, int satpos, const Operand &src, Condition cond=al)
BlockConstPoolScope(Assembler *assem)
void ubfx(Register dst, Register src, int lsb, int width, Condition cond=al)
#define ASSERT_EQ(v1, v2)
void bx(Register target, Condition cond=al)
void ldrsh(Register dst, const MemOperand &src, Condition cond=al)
SwVfpRegister low() const
static const int kJSReturnSequenceInstructions
uint32_t SRegisterFieldMask
void orr(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
bool is(DwVfpRegister reg) const
PositionsRecorder * positions_recorder()
const int kRegister_r0_Code
~PredictableCodeSizeScope()
static const int kInstrSize
void cdp(Coprocessor coproc, int opcode_1, CRegister crd, CRegister crn, CRegister crm, int opcode_2, Condition cond=al)
MemOperand(Register rn, int32_t offset=0)
static const char * AllocationIndexToString(int index)
static const int kSizeInBytes
const int kRegister_r1_Code
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
void cmp(Register src1, Register src2, Condition cond=al)
void bfc(Register dst, int lsb, int width, Condition cond=al)
void mls(Register dst, Register src1, Register src2, Register srcA, Condition cond=al)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
void and_(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
void label_at_put(Label *L, int at_offset)
const int kRegister_r9_Code
const int kRegister_ip_Code
const int kRegister_sp_Code
void umull(Register dstL, Register dstH, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
static bool IsLdrRegisterImmediate(Instr instr)
void msr(SRegisterFieldMask fields, const Operand &src, Condition cond=al)
void ldc(Coprocessor coproc, CRegister crd, const MemOperand &src, LFlag l=Short, Condition cond=al)
static bool IsLdrRegFpNegOffset(Instr instr)
void bkpt(uint32_t imm16)
static const int kPatchDebugBreakSlotAddressOffset
void vstm(BlockAddrMode am, Register base, DwVfpRegister first, DwVfpRegister last, Condition cond=al)
static int GetLdrRegisterImmediateOffset(Instr instr)
void b(Label *L, Condition cond=al)
TypeFeedbackId recorded_ast_id_
void sub(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
bool emit_debug_code() const
void vcvt_f32_s32(const SwVfpRegister dst, const SwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
void rsc(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
void tst(Register src1, const Operand &src2, Condition cond=al)
static bool IsLdrRegFpOffset(Instr instr)
void add(Register dst, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
const int kRegister_no_reg_Code
static const int kNumReservedRegisters
void mcr2(Coprocessor coproc, int opcode_1, Register rd, CRegister crn, CRegister crm, int opcode_2=0)
void mul(Register dst, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
static bool IsLdrPcImmediateOffset(Instr instr)
void mcr(Coprocessor coproc, int opcode_1, Register rd, CRegister crn, CRegister crm, int opcode_2=0, Condition cond=al)
void split_code(int *vm, int *m) const
static const int kMaxDistToPool
void adc(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)