36 #ifndef V8_MIPS_ASSEMBLER_MIPS_H_
37 #define V8_MIPS_ASSEMBLER_MIPS_H_
99 const char*
const names[] = {
138 #define REGISTER(N, C) \
139 const int kRegister_ ## N ## _Code = C; \
140 const Register N = { C }
315 #define kRootRegister s6
317 #define kLithiumScratchReg s3
318 #define kLithiumScratchReg2 s4
319 #define kLithiumScratchDouble f30
320 #define kDoubleRegZero f28
355 RelocInfo::Mode
rmode = RelocInfo::NONE32));
367 INLINE(
bool is_reg()
const);
379 RelocInfo::Mode rmode_;
402 return is_int16(offset_);
423 return Check(f, supported_);
428 return Check(f, found_by_runtime_probing_only_);
432 return Check(f, cross_compile_) ||
438 return cross_compile_ == 0;
442 unsigned mask = flag2set(f);
443 return cross_compile_ == 0 ||
444 (cross_compile_ & mask) == mask;
448 static bool Check(
CpuFeature f,
unsigned set) {
449 return (set & flag2set(f)) != 0;
457 static bool initialized_;
459 static unsigned supported_;
460 static unsigned found_by_runtime_probing_only_;
462 static unsigned cross_compile_;
470 class Assembler :
public AssemblerBase {
649 void nop(
unsigned int type = 0) {
651 Register nop_rt_reg = (type == 0) ? zero_reg : at;
652 sll(zero_reg, nop_rt_reg, type,
true);
752 void break_(uint32_t
code,
bool break_as_stop =
false);
924 void db(uint8_t data);
925 void dd(uint32_t data);
939 inline bool overflow()
const {
return pc_ >= reloc_info_writer.pos() - kGap; }
947 *
reinterpret_cast<Instr*
>(
pc) = instr;
968 static bool IsNop(
Instr instr,
unsigned int type);
1033 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
1037 if (no_trampoline_pool_before_ < pc_offset)
1042 trampoline_pool_blocked_nesting_++;
1046 trampoline_pool_blocked_nesting_--;
1050 return trampoline_pool_blocked_nesting_ > 0;
1054 return internal_trampoline_exception_;
1060 return trampoline_emitted_;
1065 ASSERT(!block_buffer_growth_);
1066 block_buffer_growth_ =
true;
1070 ASSERT(block_buffer_growth_);
1071 block_buffer_growth_ =
false;
1075 return block_buffer_growth_;
1081 static const int kBufferCheckInterval = 1*
KB/2;
1088 static const int kGap = 32;
1094 static const int kCheckConstIntervalInst = 32;
1095 static const int kCheckConstInterval = kCheckConstIntervalInst *
kInstrSize;
1097 int next_buffer_check_;
1100 int trampoline_pool_blocked_nesting_;
1101 int no_trampoline_pool_before_;
1104 int last_trampoline_pool_end_;
1107 bool block_buffer_growth_;
1111 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize;
1112 RelocInfoWriter reloc_info_writer;
1115 int last_bound_pos_;
1118 inline void CheckBuffer();
1120 inline void emit(
Instr x);
1121 inline void CheckTrampolinePoolQuick();
1131 void GenInstrRegister(
Opcode opcode,
1138 void GenInstrRegister(
Opcode opcode,
1145 void GenInstrRegister(
Opcode opcode,
1152 void GenInstrRegister(
Opcode opcode,
1159 void GenInstrRegister(
Opcode opcode,
1166 void GenInstrRegister(
Opcode opcode,
1173 void GenInstrImmediate(
Opcode opcode,
1177 void GenInstrImmediate(
Opcode opcode,
1181 void GenInstrImmediate(
Opcode opcode,
1187 void GenInstrJump(
Opcode opcode,
1191 void LoadRegPlusOffsetToAt(
const MemOperand& src);
1194 void print(Label*
L);
1195 void bind_to(Label*
L,
int pos);
1196 void next(Label*
L);
1211 free_slot_count_ = 0;
1214 Trampoline(
int start,
int slot_count) {
1217 free_slot_count_ = slot_count;
1218 end_ = start + slot_count * kTrampolineSlotsSize;
1227 int trampoline_slot = kInvalidSlotPos;
1228 if (free_slot_count_ <= 0) {
1235 trampoline_slot = next_slot_;
1237 next_slot_ += kTrampolineSlotsSize;
1239 return trampoline_slot;
1246 int free_slot_count_;
1250 int unbound_labels_count_;
1256 bool trampoline_emitted_;
1257 static const int kTrampolineSlotsSize = 4 *
kInstrSize;
1258 static const int kMaxBranchOffset = (1 << (18 - 1)) - 1;
1259 static const int kInvalidSlotPos = -1;
1261 Trampoline trampoline_;
1262 bool internal_trampoline_exception_;
1278 assembler->CheckBuffer();
1284 #endif // V8_ARM_ASSEMBLER_MIPS_H_
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
void addu(Register rd, Register rs, Register rt)
static bool IsBranch(Instr instr)
void EndBlockGrowBuffer()
Isolate * isolate() const
int InstructionsGeneratedSince(Label *label)
static const int kBranchPCOffset
void madd_d(FPURegister fd, FPURegister fr, FPURegister fs, FPURegister ft)
void andi(Register rd, Register rs, int32_t j)
void beq(Register rs, Register rt, int16_t offset)
void cvt_l_d(FPURegister fd, FPURegister fs)
static int GetBranchOffset(Instr instr)
static uint32_t GetRt(Instr instr)
void ClearRecordedAstId()
void trunc_l_d(FPURegister fd, FPURegister fs)
static const int kDebugBreakSlotInstructions
static const int kMaxNumRegisters
static uint32_t GetOpcodeField(Instr instr)
void mtc1(Register rt, FPURegister fs)
void PopulateConstantPool(ConstantPoolArray *constant_pool)
static bool IsAddImmediate(Instr instr)
void bc1t(Label *L, uint16_t cc=0)
static Register GetRsReg(Instr instr)
void round_l_s(FPURegister fd, FPURegister fs)
static int ToAllocationIndex(FPURegister reg)
void swc1(FPURegister fs, const MemOperand &dst)
void round_w_d(FPURegister fd, FPURegister fs)
void bgezal(Register rs, int16_t offset)
void instr_at_put(int pos, Instr instr)
void neg_d(FPURegister fd, FPURegister fs)
void blez(Register rs, int16_t offset)
void sw(Register rd, const MemOperand &rs)
void cvt_s_l(FPURegister fd, FPURegister fs)
void mov_d(FPURegister fd, FPURegister fs)
static TypeFeedbackId None()
void rotr(Register rd, Register rt, uint16_t sa)
static uint32_t GetImmediate16(Instr instr)
void sqrt_d(FPURegister fd, FPURegister fs)
static bool IsSw(Instr instr)
static Instr SetAddImmediateOffset(Instr instr, int16_t offset)
static uint32_t GetFunctionField(Instr instr)
static const int kPatchDebugBreakSlotReturnOffset
int SizeOfCodeGeneratedSince(Label *label)
void tne(Register rs, Register rt, uint16_t code)
int32_t immediate() const
void or_(Register dst, int32_t imm32)
void round_w_s(FPURegister fd, FPURegister fs)
static int NumAllocatableRegisters()
const int kInvalidFPUControlRegister
void b(int branch_offset, Condition cond=al)
int32_t buffer_space() const
void floor_l_s(FPURegister fd, FPURegister fs)
static bool IsSupported(CpuFeature f)
static uint32_t GetRsField(Instr instr)
void mul_d(FPURegister fd, FPURegister fs, FPURegister ft)
void clz(Register dst, Register src, Condition cond=al)
void bc1t(int16_t offset, uint16_t cc=0)
void div(Register rs, Register rt)
static Address target_address_at(Address pc, ConstantPoolArray *constant_pool)
static uint32_t GetRs(Instr instr)
void j(Condition cc, Label *L, Label::Distance distance=Label::kFar)
static bool IsLwRegFpOffset(Instr instr)
BlockGrowBufferScope(Assembler *assem)
static Register FromAllocationIndex(int index)
bool is(FPURegister creg) const
const uint32_t kMaxStopCode
TypeFeedbackId RecordedAstId()
#define ASSERT(condition)
void swr(Register rd, const MemOperand &rs)
void ext_(Register rt, Register rs, uint16_t pos, uint16_t size)
static const int kPatchReturnSequenceAddressOffset
void pref(int32_t hint, const MemOperand &rs)
void SetRecordedAstId(TypeFeedbackId ast_id)
static bool IsSafeForSnapshot(CpuFeature f)
const FPUControlRegister no_fpucreg
static uint32_t GetRdField(Instr instr)
static Instr instr_at(byte *pc)
void DoubleAsTwoUInt32(double d, uint32_t *lo, uint32_t *hi)
static Instr SetSwOffset(Instr instr, int16_t offset)
void sll(Register rd, Register rt, uint16_t sa, bool coming_from_nop=false)
void cvt_d_s(FPURegister fd, FPURegister fs)
static bool IsJalr(Instr instr)
void floor_w_s(FPURegister fd, FPURegister fs)
static bool IsJ(Instr instr)
void addiu(Register rd, Register rs, int32_t j)
void cvt_d_l(FPURegister fd, FPURegister fs)
static void instr_at_put(byte *pc, Instr instr)
static const int kMaxNumAllocatableRegisters
static bool IsLwRegFpNegOffset(Instr instr)
void target_at_put(int pos, int target_pos)
void multu(Register rs, Register rt)
void add_d(FPURegister fd, FPURegister fs, FPURegister ft)
MemOperand(Register base, ptrdiff_t offset=0, AddrMode addrmode=Offset)
void CheckTrampolinePool()
ConstantPoolArray * constant_pool()
bool is_buffer_growth_blocked() const
static const int kNumRegisters
void ldc1(FPURegister fd, const MemOperand &src)
void cvt_d_w(FPURegister fd, FPURegister fs)
~BlockTrampolinePoolScope()
const int kNumFPURegisters
void cvt_w_d(FPURegister fd, FPURegister fs)
EnsureSpace(Assembler *assembler)
static void JumpLabelToJumpRegister(Address pc)
static const char * AllocationIndexToString(int index)
void break_(uint32_t code, bool break_as_stop=false)
static bool IsPush(Instr instr)
void ceil_w_s(FPURegister fd, FPURegister fs)
void sh(Register rd, const MemOperand &rs)
static const int kMaxNumAllocatableRegisters
static bool IsJr(Instr instr)
DwVfpRegister DoubleRegister
static bool IsOri(Instr instr)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
void sra(Register rt, Register rd, uint16_t sa)
void slt(Register rd, Register rs, Register rt)
void swl(Register rd, const MemOperand &rs)
static Instr SF(Register rd)
void lwr(Register rd, const MemOperand &rs)
void BlockTrampolinePoolBefore(int pc_offset)
void lbu(Register rd, const MemOperand &rs)
static bool IsJal(Instr instr)
static const int kNumReservedRegisters
FPURegister FloatRegister
void ceil_w_d(FPURegister fd, FPURegister fs)
INLINE(static Address target_address_at(Address pc, ConstantPoolArray *constant_pool))
void trunc_l_s(FPURegister fd, FPURegister fs)
void trunc_w_s(FPURegister fd, FPURegister fs)
void srlv(Register rd, Register rt, Register rs)
INLINE(static void set_target_address_at(Address pc, ConstantPoolArray *constant_pool, Address target))
static const int kSpecialTargetSize
friend class ExternalReference
void div_d(FPURegister fd, FPURegister fs, FPURegister ft)
void abs_d(FPURegister fd, FPURegister fs)
void sltu(Register rd, Register rs, Register rt)
void GetCode(CodeDesc *desc)
void xori(Register rd, Register rs, int32_t j)
void jal_or_jalr(int32_t target, Register rs)
static const int kPcLoadDelta
void teq(Register src1, const Operand &src2, Condition cond=al)
int branch_offset(Label *L, bool jump_elimination_allowed)
int available_space() const
static bool IsPop(Instr instr)
static const int kInstructionsFor32BitConstant
void movt(Register reg, uint32_t immediate, Condition cond=al)
void lui(Register rd, int32_t j)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
void StartBlockTrampolinePool()
INLINE(static Address target_address_at(Address pc, Code *code))
static Register from_code(int code)
static bool IsLw(Instr instr)
static uint32_t GetFunction(Instr instr)
bool is(FPUControlRegister creg) const
void srl(Register rd, Register rt, uint16_t sa)
static Register GetRdReg(Instr instr)
void bc1f(Label *L, uint16_t cc=0)
MaybeObject * AllocateConstantPool(Heap *heap)
static int NumAllocatableRegisters()
void tlt(Register rs, Register rt, uint16_t code)
static bool IsFoundByRuntimeProbingOnly(CpuFeature f)
void slti(Register rd, Register rs, int32_t j)
void srav(Register rt, Register rd, Register rs)
static uint32_t GetRtField(Instr instr)
bool is_trampoline_emitted() const
void sltiu(Register rd, Register rs, int32_t j)
void jalr(Register rs, Register rd=ra)
void movz(const Register &rd, uint64_t imm, int shift=-1)
void floor_l_d(FPURegister fd, FPURegister fs)
void cfc1(Register rt, FPUControlRegister fs)
void StartBlockGrowBuffer()
static const int kCallTargetAddressOffset
void ins_(Register rt, Register rs, uint16_t pos, uint16_t size)
static Register GetRtReg(Instr instr)
void beq(Register rs, Register rt, Label *L)
static const int kDebugBreakSlotLength
void lw(Register rd, const MemOperand &rs)
void ceil_l_d(FPURegister fd, FPURegister fs)
bool has_exception() const
static Register GetRd(Instr instr)
static bool IsNop(Instr instr, int type=NON_MARKING_NOP)
void RecordDebugBreakSlot()
static uint32_t GetLabelConst(Instr instr)
void ori(Register rd, Register rs, int32_t j)
void stop(const char *msg, Condition cond=al, int32_t code=kDefaultStopCode)
void cvt_s_w(FPURegister fd, FPURegister fs)
static const int kCpRegister
int ToNumber(Register reg)
void round_l_d(FPURegister fd, FPURegister fs)
bool is(Register reg) const
friend class PlatformFeatureScope
bool is_trampoline_pool_blocked() const
Operand(Register reg, Shift shift=LSL, unsigned shift_amount=0)
Handle< T > handle(T *t, Isolate *isolate)
void movf(Register rd, Register rs, uint16_t cc=0)
void RecordComment(const char *msg)
INLINE(static HeapObject *EnsureDoubleAligned(Heap *heap, HeapObject *object, int size))
static void QuietNaN(HeapObject *nan)
const FPUControlRegister FCSR
static const char * AllocationIndexToString(int index)
void hint(SystemHint code)
void emit_code_stub_address(Code *stub)
void bltzal(Register rs, int16_t offset)
void cvt_w_s(FPURegister fd, FPURegister fs)
void lwl(Register rd, const MemOperand &rs)
void bne(Register rs, Register rt, int16_t offset)
const FPURegister no_freg
static Address target_address_from_return_address(Address pc)
void xor_(Register dst, int32_t imm32)
void BlockTrampolinePoolFor(int instructions)
friend class PositionsRecorder
static bool IsSwRegFpOffset(Instr instr)
static bool IsJump(Instr instr)
bool OffsetIsInt16Encodable() const
void mfc1(Register rt, FPURegister fs)
static bool VerifyCrossCompiling()
void mult(Register rs, Register rt)
void subu(Register rd, Register rs, Register rt)
static int RelocateInternalReference(byte *pc, intptr_t pc_delta)
void tgeu(Register rs, Register rt, uint16_t code)
Assembler(Isolate *isolate, void *buffer, int buffer_size)
static uint32_t GetSa(Instr instr)
bool MustUseReg(RelocInfo::Mode rmode)
void trunc_w_d(FPURegister fd, FPURegister fs)
static const int kJSReturnSequenceInstructions
static bool IsEmittedConstant(Instr instr)
INLINE(static void set_target_address_at(Address pc, Code *code, Address target))
void sllv(Register rd, Register rt, Register rs)
void ctc1(Register rt, FPUControlRegister fs)
void floor_w_d(FPURegister fd, FPURegister fs)
void bne(Register rs, Register rt, Label *L)
void sdc1(FPURegister fs, const MemOperand &dst)
void lh(Register rd, const MemOperand &rs)
static bool IsBne(Instr instr)
void bc1f(int16_t offset, uint16_t cc=0)
PositionsRecorder * positions_recorder()
void movn(const Register &rd, uint64_t imm, int shift=-1)
static bool IsBeq(Instr instr)
static const int kInstrSize
static const int kSizeInBytes
static void set_target_address_at(Address pc, ConstantPoolArray *constant_pool, Address target)
void fcmp(const FPRegister &fn, const FPRegister &fm)
void ceil_l_s(FPURegister fd, FPURegister fs)
void tge(Register rs, Register rt, uint16_t code)
void cvt_s_d(FPURegister fd, FPURegister fs)
static int ToAllocationIndex(Register reg)
void and_(Register dst, Register src1, const Operand &src2, SBit s=LeaveCC, Condition cond=al)
void label_at_put(Label *L, int at_offset)
void bgtz(Register rs, int16_t offset)
void nor(Register rd, Register rs, Register rt)
static int16_t GetLwOffset(Instr instr)
static FPURegister from_code(int code)
static FPURegister FromAllocationIndex(int index)
void nop(unsigned int type=0)
int32_t shifted_branch_offset(Label *L, bool jump_elimination_allowed)
static bool IsSwRegFpNegOffset(Instr instr)
void lb(Register rd, const MemOperand &rs)
Register ToRegister(int num)
int64_t immediate() const
uint32_t jump_address(Label *L)
void j_or_jr(int32_t target, Register rs)
void rotrv(Register rd, Register rt, Register rs)
void bgez(Register rs, int16_t offset)
void cvt_l_s(FPURegister fd, FPURegister fs)
void lhu(Register rd, const MemOperand &rs)
static bool VerifyCrossCompiling(CpuFeature f)
static const int kPatchDebugBreakSlotAddressOffset
BlockTrampolinePoolScope(Assembler *assem)
void tltu(Register rs, Register rt, uint16_t code)
static Instr SetLwOffset(Instr instr, int16_t offset)
TypeFeedbackId recorded_ast_id_
static uint32_t GetSaField(Instr instr)
static int NumRegisters()
void divu(Register rs, Register rt)
RelocInfo::Mode rmode() const
void bltz(Register rs, int16_t offset)
void lwc1(FPURegister fd, const MemOperand &src)
void EndBlockTrampolinePool()
void sub_d(FPURegister fd, FPURegister fs, FPURegister ft)
void mul(Register dst, Register src1, Register src2, SBit s=LeaveCC, Condition cond=al)
static bool IsLui(Instr instr)
static bool IsAndImmediate(Instr instr)
void c(FPUCondition cond, SecondaryField fmt, FPURegister ft, FPURegister fs, uint16_t cc=0)
static void deserialization_set_special_target_at(Address instruction_payload, Code *code, Address target)
void sb(Register rd, const MemOperand &rs)