5 #ifndef V8_WASM_JUMP_TABLE_ASSEMBLER_H_ 6 #define V8_WASM_JUMP_TABLE_ASSEMBLER_H_ 8 #include "src/macro-assembler.h" 9 #include "src/wasm/wasm-code-manager.h" 34 uint32_t line_index = slot_offset / kJumpTableLineSize;
35 uint32_t line_offset = slot_offset % kJumpTableLineSize;
36 DCHECK_EQ(0, line_offset % kJumpTableSlotSize);
37 return line_index * kJumpTableSlotsPerLine +
38 line_offset / kJumpTableSlotSize;
43 uint32_t line_index = slot_index / kJumpTableSlotsPerLine;
45 (slot_index % kJumpTableSlotsPerLine) * kJumpTableSlotSize;
46 return line_index * kJumpTableLineSize + line_offset;
53 return ((slot_count + kJumpTableSlotsPerLine - 1) /
54 kJumpTableSlotsPerLine) *
61 WasmCode::FlushICache flush_i_cache) {
62 Address slot = base + SlotIndexToOffset(slot_index);
64 jtasm.EmitLazyCompileJumpSlot(func_index, lazy_compile_target);
65 jtasm.NopBytes(kJumpTableSlotSize - jtasm.pc_offset());
67 Assembler::FlushICache(slot, kJumpTableSlotSize);
73 WasmCode::FlushICache flush_i_cache) {
74 Address slot = base + SlotIndexToOffset(slot_index);
76 jtasm.EmitJumpSlot(new_target);
77 jtasm.NopBytes(kJumpTableSlotSize - jtasm.pc_offset());
79 Assembler::FlushICache(slot, kJumpTableSlotSize);
87 reinterpret_cast<void*>(slot_addr), size,
88 CodeObjectRequired::kNo) {}
93 #if V8_TARGET_ARCH_X64 94 static constexpr
int kJumpTableLineSize = 64;
95 static constexpr
int kJumpTableSlotSize = 18;
96 #elif V8_TARGET_ARCH_IA32 97 static constexpr
int kJumpTableLineSize = 64;
98 static constexpr
int kJumpTableSlotSize = 10;
99 #elif V8_TARGET_ARCH_ARM 100 static constexpr
int kJumpTableLineSize = 5 * kInstrSize;
101 static constexpr
int kJumpTableSlotSize = 5 * kInstrSize;
102 #elif V8_TARGET_ARCH_ARM64 103 static constexpr
int kJumpTableLineSize = 3 * kInstrSize;
104 static constexpr
int kJumpTableSlotSize = 3 * kInstrSize;
105 #elif V8_TARGET_ARCH_S390X 106 static constexpr
int kJumpTableLineSize = 20;
107 static constexpr
int kJumpTableSlotSize = 20;
108 #elif V8_TARGET_ARCH_S390 109 static constexpr
int kJumpTableLineSize = 14;
110 static constexpr
int kJumpTableSlotSize = 14;
111 #elif V8_TARGET_ARCH_PPC64 112 static constexpr
int kJumpTableLineSize = 48;
113 static constexpr
int kJumpTableSlotSize = 48;
114 #elif V8_TARGET_ARCH_PPC 115 static constexpr
int kJumpTableLineSize = 24;
116 static constexpr
int kJumpTableSlotSize = 24;
117 #elif V8_TARGET_ARCH_MIPS 118 static constexpr
int kJumpTableLineSize = 6 * kInstrSize;
119 static constexpr
int kJumpTableSlotSize = 6 * kInstrSize;
120 #elif V8_TARGET_ARCH_MIPS64 121 static constexpr
int kJumpTableLineSize = 8 * kInstrSize;
122 static constexpr
int kJumpTableSlotSize = 8 * kInstrSize;
124 static constexpr
int kJumpTableLineSize = 1;
125 static constexpr
int kJumpTableSlotSize = 1;
128 static constexpr
int kJumpTableSlotsPerLine =
129 kJumpTableLineSize / kJumpTableSlotSize;
137 options.disable_reloc_info_for_patching =
true;
141 void EmitLazyCompileJumpSlot(
uint32_t func_index,
144 void EmitJumpSlot(
Address target);
146 void NopBytes(
int bytes);
153 #endif // V8_WASM_JUMP_TABLE_ASSEMBLER_H_