5 #include "src/wasm/jump-table-assembler.h" 7 #include "src/assembler-inl.h" 8 #include "src/macro-assembler-inl.h" 16 #if V8_TARGET_ARCH_X64 17 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
18 Address lazy_compile_target) {
36 pushq(Immediate(func_index));
37 movq(kScratchRegister, uint64_t{lazy_compile_target});
38 jmp(kScratchRegister);
43 void JumpTableAssembler::EmitJumpSlot(Address target) {
44 movq(kScratchRegister, static_cast<uint64_t>(target));
45 jmp(kScratchRegister);
48 void JumpTableAssembler::NopBytes(
int bytes) {
53 #elif V8_TARGET_ARCH_IA32 54 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
55 Address lazy_compile_target) {
56 mov(kWasmCompileLazyFuncIndexRegister, func_index);
57 jmp(lazy_compile_target, RelocInfo::NONE);
60 void JumpTableAssembler::EmitJumpSlot(Address target) {
61 jmp(target, RelocInfo::NONE);
64 void JumpTableAssembler::NopBytes(
int bytes) {
69 #elif V8_TARGET_ARCH_ARM 70 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
71 Address lazy_compile_target) {
75 Move32BitImmediate(kWasmCompileLazyFuncIndexRegister, Operand(func_index));
81 EmitJumpSlot(lazy_compile_target);
84 void JumpTableAssembler::EmitJumpSlot(Address target) {
87 Move32BitImmediate(pc, Operand(target, RelocInfo::WASM_CALL));
88 CheckConstPool(
true,
false);
91 void JumpTableAssembler::NopBytes(
int bytes) {
93 DCHECK_EQ(0, bytes % kInstrSize);
94 for (; bytes > 0; bytes -= kInstrSize) {
99 #elif V8_TARGET_ARCH_ARM64 100 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
101 Address lazy_compile_target) {
102 Mov(kWasmCompileLazyFuncIndexRegister.W(), func_index);
103 Jump(lazy_compile_target, RelocInfo::NONE);
106 void JumpTableAssembler::EmitJumpSlot(Address target) {
110 Jump(target, RelocInfo::NONE);
113 void JumpTableAssembler::NopBytes(
int bytes) {
115 DCHECK_EQ(0, bytes % kInstrSize);
116 for (; bytes > 0; bytes -= kInstrSize) {
121 #elif V8_TARGET_ARCH_S390 122 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
123 Address lazy_compile_target) {
125 lgfi(kWasmCompileLazyFuncIndexRegister, Operand(func_index));
127 mov(r1, Operand(lazy_compile_target));
131 void JumpTableAssembler::EmitJumpSlot(Address target) {
132 mov(r1, Operand(target));
136 void JumpTableAssembler::NopBytes(
int bytes) {
138 DCHECK_EQ(0, bytes % 2);
139 for (; bytes > 0; bytes -= 2) {
144 #elif V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 145 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
146 Address lazy_compile_target) {
147 li(kWasmCompileLazyFuncIndexRegister, func_index);
150 Jump(lazy_compile_target, RelocInfo::NONE);
153 void JumpTableAssembler::EmitJumpSlot(Address target) {
154 Jump(target, RelocInfo::NONE);
157 void JumpTableAssembler::NopBytes(
int bytes) {
159 DCHECK_EQ(0, bytes % kInstrSize);
160 for (; bytes > 0; bytes -= kInstrSize) {
165 #elif V8_TARGET_ARCH_PPC 166 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
167 Address lazy_compile_target) {
169 mov(kWasmCompileLazyFuncIndexRegister, Operand(func_index));
171 mov(r0, Operand(lazy_compile_target));
176 void JumpTableAssembler::EmitJumpSlot(Address target) {
177 mov(r0, Operand(target));
182 void JumpTableAssembler::NopBytes(
int bytes) {
184 DCHECK_EQ(0, bytes % 4);
185 for (; bytes > 0; bytes -= 4) {
191 void JumpTableAssembler::EmitLazyCompileJumpSlot(
uint32_t func_index,
192 Address lazy_compile_target) {
196 void JumpTableAssembler::EmitJumpSlot(Address target) { UNIMPLEMENTED(); }
198 void JumpTableAssembler::NopBytes(
int bytes) {