64 uint32_t line_index = slot_offset / kJumpTableLineSize;
65 uint32_t line_offset = slot_offset % kJumpTableLineSize;
66 DCHECK_EQ(0, line_offset % kJumpTableSlotSize);
67 return line_index * kJumpTableSlotsPerLine +
68 line_offset / kJumpTableSlotSize;
73 uint32_t line_index = slot_index / kJumpTableSlotsPerLine;
74 uint32_t line_offset =
75 (slot_index % kJumpTableSlotsPerLine) * kJumpTableSlotSize;
76 return line_index * kJumpTableLineSize + line_offset;
81 return ((slot_count + kJumpTableSlotsPerLine - 1) /
82 kJumpTableSlotsPerLine) *
88 return slot_index * kFarJumpTableSlotSize;
94 return offset / kFarJumpTableSlotSize;
100 int num_runtime_slots,
int num_function_slots) {
101 int num_entries = num_runtime_slots + num_function_slots;
102 return num_entries * kFarJumpTableSlotSize;
107 return slot_index * kLazyCompileTableSlotSize;
112 return slot_count * kLazyCompileTableSlotSize;
115 static void GenerateLazyCompileTable(Address
base, uint32_t num_slots,
116 uint32_t num_imported_functions,
117 Address wasm_compile_lazy_target);
121 static void InitializeJumpsToLazyCompileTable(
122 Address
base, uint32_t num_slots, Address lazy_compile_table_start);
125 Address
base, Address* stub_targets,
126 int num_runtime_slots,
127 int num_function_slots) {
128 uint32_t table_size =
129 SizeForNumberOfFarJumpSlots(num_runtime_slots, num_function_slots);
133 for (
int index = 0; index < num_runtime_slots + num_function_slots;
141 offset += kFarJumpTableSlotSize;
148 Address jump_table_slot,
149 Address far_jump_table_slot, Address target) {
155 DCHECK_NE(kNullAddress, far_jump_table_slot);
156 JumpTableAssembler::PatchFarJumpSlot(jump_table_pair.far_jump_table(),
157 far_jump_table_slot, target);
171 : jit_allocation_(jit_allocation),
172 buffer_start_(slot_addr),
184#if V8_TARGET_ARCH_X64
185#ifdef V8_ENABLE_CET_IBT
186 static constexpr int kJumpTableSlotSize = 16;
188 static constexpr int kJumpTableSlotSize = 8;
190 static constexpr int kJumpTableLineSize = kJumpTableSlotSize;
191 static constexpr int kFarJumpTableSlotSize = 16;
192 static constexpr int kLazyCompileTableSlotSize = 10;
193#elif V8_TARGET_ARCH_IA32
194 static constexpr int kJumpTableLineSize = 64;
195 static constexpr int kJumpTableSlotSize = 5;
196 static constexpr int kFarJumpTableSlotSize = 5;
197 static constexpr int kLazyCompileTableSlotSize = 10;
198#elif V8_TARGET_ARCH_ARM
199 static constexpr int kJumpTableLineSize = 2 *
kInstrSize;
200 static constexpr int kJumpTableSlotSize = 2 *
kInstrSize;
201 static constexpr int kFarJumpTableSlotSize = 2 *
kInstrSize;
202 static constexpr int kLazyCompileTableSlotSize = 4 *
kInstrSize;
203#elif V8_TARGET_ARCH_ARM64
204#if V8_ENABLE_CONTROL_FLOW_INTEGRITY
205 static constexpr int kJumpTableLineSize = 2 *
kInstrSize;
206 static constexpr int kJumpTableSlotSize = 2 *
kInstrSize;
208 static constexpr int kJumpTableLineSize = 1 *
kInstrSize;
209 static constexpr int kJumpTableSlotSize = 1 *
kInstrSize;
211 static constexpr int kFarJumpTableSlotSize = 4 *
kInstrSize;
212 static constexpr int kLazyCompileTableSlotSize = 4 *
kInstrSize;
213#elif V8_TARGET_ARCH_S390X
214 static constexpr int kJumpTableLineSize = 128;
215 static constexpr int kJumpTableSlotSize = 8;
216 static constexpr int kFarJumpTableSlotSize = 24;
217 static constexpr int kLazyCompileTableSlotSize = 32;
218#elif V8_TARGET_ARCH_PPC64
219 static constexpr int kJumpTableLineSize = 64;
220 static constexpr int kJumpTableSlotSize = 1 *
kInstrSize;
221 static constexpr int kFarJumpTableSlotSize = 12 *
kInstrSize;
222 static constexpr int kLazyCompileTableSlotSize = 12 *
kInstrSize;
223#elif V8_TARGET_ARCH_MIPS
224 static constexpr int kJumpTableLineSize = 8 *
kInstrSize;
225 static constexpr int kJumpTableSlotSize = 8 *
kInstrSize;
226 static constexpr int kFarJumpTableSlotSize = 4 *
kInstrSize;
227 static constexpr int kLazyCompileTableSlotSize = 6 *
kInstrSize;
228#elif V8_TARGET_ARCH_MIPS64
229 static constexpr int kJumpTableLineSize = 8 *
kInstrSize;
230 static constexpr int kJumpTableSlotSize = 8 *
kInstrSize;
231 static constexpr int kFarJumpTableSlotSize = 8 *
kInstrSize;
232 static constexpr int kLazyCompileTableSlotSize = 10 *
kInstrSize;
233#elif V8_TARGET_ARCH_RISCV64
234 static constexpr int kJumpTableSlotSize = 2 *
kInstrSize;
235 static constexpr int kJumpTableLineSize = kJumpTableSlotSize;
236 static constexpr int kFarJumpTableSlotSize = 6 *
kInstrSize;
237 static constexpr int kLazyCompileTableSlotSize = 3 *
kInstrSize;
238#elif V8_TARGET_ARCH_RISCV32
239 static constexpr int kJumpTableSlotSize = 5 *
kInstrSize;
240 static constexpr int kJumpTableLineSize = kJumpTableSlotSize;
241 static constexpr int kFarJumpTableSlotSize = kJumpTableSlotSize;
242 static constexpr int kLazyCompileTableSlotSize = 3 *
kInstrSize;
243#elif V8_TARGET_ARCH_LOONG64
244 static constexpr int kJumpTableLineSize = 1 *
kInstrSize;
245 static constexpr int kJumpTableSlotSize = 1 *
kInstrSize;
246 static constexpr int kFarJumpTableSlotSize = 6 *
kInstrSize;
247 static constexpr int kLazyCompileTableSlotSize = 3 *
kInstrSize;
249#error Unknown architecture.
252 static constexpr int kJumpTableSlotsPerLine =
253 kJumpTableLineSize / kJumpTableSlotSize;
254 static_assert(kJumpTableSlotsPerLine >= 1);
257 Address lazy_compile_target);
268 Address slot, Address target);
272 int pc_offset()
const {
return static_cast<int>(
pc_ - buffer_start_); }
274 template <
typename V>
277 template <
typename V>