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(
Instr instr = 0)
const;
428 bool must_use_constant_pool()
const;
445 RelocInfo::Mode rmode_;
512 if (f ==
VFP3 && !FLAG_enable_vfp3)
return false;
513 return (supported_ & (1u << f)) != 0;
520 Isolate* isolate = Isolate::UncheckedCurrent();
521 if (isolate ==
NULL) {
526 unsigned enabled =
static_cast<unsigned>(isolate->enabled_cpu_features());
527 return (enabled & (1u << f)) != 0;
537 unsigned mask = 1u << f;
540 (CpuFeatures::found_by_runtime_probing_ & mask) == 0);
541 isolate_ = Isolate::UncheckedCurrent();
543 if (isolate_ !=
NULL) {
544 old_enabled_ =
static_cast<unsigned>(isolate_->enabled_cpu_features());
545 isolate_->set_enabled_cpu_features(old_enabled_ | mask);
549 ASSERT_EQ(Isolate::UncheckedCurrent(), isolate_);
550 if (isolate_ !=
NULL) {
551 isolate_->set_enabled_cpu_features(old_enabled_);
557 unsigned old_enabled_;
570 CpuFeatures::supported_ |= (1u << f);
576 CpuFeatures::supported_ = old_supported_;
581 static bool CanForce() {
588 const unsigned old_supported_;
593 static bool initialized_;
595 static unsigned supported_;
596 static unsigned found_by_runtime_probing_;
598 DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
796 sub(dst, src1, Operand(src2), s, cond);
806 add(dst, src1, Operand(src2), s, cond);
820 tst(src1, Operand(src2), cond);
827 cmp(src1, Operand(src2), cond);
837 orr(dst, src1, Operand(src2), s, cond);
843 mov(dst, Operand(src), s, cond);
941 void stop(
const char* msg,
945 void bkpt(uint32_t imm16);
1226 void db(uint8_t data);
1227 void dd(uint32_t data);
1236 *
reinterpret_cast<Instr*
>(buffer_ + pos) = instr;
1240 *
reinterpret_cast<Instr*
>(
pc) = instr;
1302 if (const_pool_blocked_nesting_++ == 0) {
1312 if (--const_pool_blocked_nesting_ == 0) {
1314 ASSERT((num_pending_reloc_info_ == 0) ||
1321 next_buffer_check_ = no_const_pool_before_;
1326 return (const_pool_blocked_nesting_ > 0) ||
1338 int next_buffer_check_;
1345 static const int kGap = 32;
1362 static const int kCheckPoolIntervalInst = 32;
1363 static const int kCheckPoolInterval = kCheckPoolIntervalInst *
kInstrSize;
1371 static const int kAvgDistToPool =
kMaxDistToPool - kCheckPoolInterval;
1374 int const_pool_blocked_nesting_;
1375 int no_const_pool_before_;
1379 int first_const_pool_use_;
1383 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize;
1384 RelocInfoWriter reloc_info_writer;
1396 int num_pending_reloc_info_;
1399 int last_bound_pos_;
1402 inline void CheckBuffer();
1404 inline void emit(
Instr x);
1414 void print(Label*
L);
1415 void bind_to(Label*
L,
int pos);
1416 void link_to(Label*
L, Label* appendix);
1417 void next(Label*
L);
1420 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
1428 bool emit_debug_code_;
1437 assembler->CheckBuffer();
1444 #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)
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
void vcvt_f32_f64(const SwVfpRegister dst, const DwVfpRegister src, VFPConversionMode mode=kDefaultRoundToZero, const Condition cond=al)
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)
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
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)
INLINE(static Address target_address_address_at(Address pc))
void vmul(const DwVfpRegister dst, const DwVfpRegister src1, const DwVfpRegister src2, const Condition cond=al)
static bool IsStrRegFpOffset(Instr instr)
void vsqrt(const DwVfpRegister dst, const DwVfpRegister src, const Condition cond=al)
static Register GetRm(Instr instr)
void bl(Label *L, Condition cond=al)
#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 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 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
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 trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt 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 instructions(ARM only)") DEFINE_bool(enable_armv7
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 vmov(const DwVfpRegister dst, double imm, const Condition cond=al)
void vldm(BlockAddrMode am, Register base, DwVfpRegister first, DwVfpRegister last, Condition cond=al)
unsigned recorded_ast_id_
bool OffsetIsUint12Encodable() const
DwVfpRegister DoubleRegister
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
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()
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)
static const int kCallTargetAddressOffset
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
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)
void SetRecordedAstId(unsigned ast_id)
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)
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 trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt 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 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
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
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
void cmp(Register src1, Register src2, Condition cond=al)
void bfc(Register dst, int lsb, int width, Condition cond=al)
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)
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)