Commit f0463fe9 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Make {JumpTableAssembler} independent of wasm internals

The {JumpTableAssembler} should not include {wasm-code-manager.h}. It
only depends on assembler headers in {src/codegen}.
This removes the {flush_i_cache} parameter which is always set anyway,
removes the last include from {src/wasm} and updates the DEPS file to
forbid such includes for the future.

R=mstarzinger@chromium.org

Bug: v8:9396, v8:9477
Change-Id: Id57b35c93155c3eac7c4c9b6a41d3a1c98c0dddc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1801846
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63749}
parent 0f067efe
specific_include_rules = {
"jump-table-assembler\.(cc|h)": [
# The JumpTableAssembler should not depend on any wasm-specific headers.
# The only allowed include is 'src/codegen' for assembler headers.
"-src",
"+src/codegen",
],
"c-api\.cc": [
"+include/libplatform/libplatform.h",
"+third_party/wasm-api/wasm.h",
......
......@@ -6,7 +6,6 @@
#define V8_WASM_JUMP_TABLE_ASSEMBLER_H_
#include "src/codegen/macro-assembler.h"
#include "src/wasm/wasm-code-manager.h"
namespace v8 {
namespace internal {
......@@ -144,15 +143,12 @@ class V8_EXPORT_PRIVATE JumpTableAssembler : public MacroAssembler {
}
static void PatchJumpTableSlot(Address base, uint32_t slot_index,
Address new_target,
WasmCode::FlushICache flush_i_cache) {
Address new_target) {
Address slot = base + JumpSlotIndexToOffset(slot_index);
JumpTableAssembler jtasm(slot);
jtasm.EmitJumpSlot(new_target);
jtasm.NopBytes(kJumpTableSlotSize - jtasm.pc_offset());
if (flush_i_cache) {
FlushInstructionCache(slot, kJumpTableSlotSize);
}
FlushInstructionCache(slot, kJumpTableSlotSize);
}
private:
......
......@@ -1147,8 +1147,7 @@ void NativeModule::PatchJumpTablesLocked(uint32_t func_index, Address target) {
for (auto& code_space_data : code_space_data_) {
if (!code_space_data.jump_table) continue;
Address jump_table_base = code_space_data.jump_table->instruction_start();
JumpTableAssembler::PatchJumpTableSlot(jump_table_base, slot_index, target,
WasmCode::kFlushICache);
JumpTableAssembler::PatchJumpTableSlot(jump_table_base, slot_index, target);
}
}
......
......@@ -184,8 +184,8 @@ class JumpTablePatcher : public v8::base::Thread {
TRACE(" patcher %p patch slot " V8PRIxPTR_FMT " to thunk #%d\n", this,
slot_address, i % 2);
base::MutexGuard jump_table_guard(jump_table_mutex_);
JumpTableAssembler::PatchJumpTableSlot(
slot_start_, slot_index_, thunks_[i % 2], WasmCode::kFlushICache);
JumpTableAssembler::PatchJumpTableSlot(slot_start_, slot_index_,
thunks_[i % 2]);
}
TRACE("Patcher %p is stopping ...\n", this);
}
......@@ -242,8 +242,8 @@ TEST(JumpTablePatchingStress) {
std::vector<std::unique_ptr<TestingAssemblerBuffer>> thunk_buffers;
// Patch the jump table slot to jump to itself. This will later be patched
// by the patchers.
JumpTableAssembler::PatchJumpTableSlot(
slot_start, slot, slot_start + slot_offset, WasmCode::kFlushICache);
JumpTableAssembler::PatchJumpTableSlot(slot_start, slot,
slot_start + slot_offset);
// For each patcher, generate two thunks where this patcher can emit code
// which finally jumps back to {slot} in the jump table.
std::vector<Address> patcher_thunks;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment