Commit 03c1b90f authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Revert "[wasm] Patch jump tables in all code spaces"

This reverts commit d7d25d2a.

Reason for revert: crashes win32-debug: https://ci.chromium.org/p/v8/builders/ci/V8%20Win32%20-%20debug/21970

Original change's description:
> [wasm] Patch jump tables in all code spaces
> 
> If there are multiple code spaces, make sure to patch the jump tables
> in all of them.
> 
> R=​mstarzinger@chromium.org
> 
> Bug: v8:9477
> Change-Id: I2ec3d3de913b99623fd310004555337329588da0
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1789289
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#63651}

TBR=mstarzinger@chromium.org,clemensh@chromium.org

Change-Id: I4bdeb7394ebf002e3a84fececb0defba8bc9065d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9477
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1796064Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63654}
parent 493a79f6
......@@ -839,13 +839,13 @@ void NativeModule::UseLazyStub(uint32_t func_index) {
// Add jump table entry for jump to the lazy compile stub.
uint32_t slot_index = func_index - module_->num_imported_functions;
DCHECK_NULL(code_table_[slot_index]);
DCHECK_NE(runtime_stub_entry(WasmCode::kWasmCompileLazy), kNullAddress);
Address lazy_compile_target =
lazy_compile_table_->instruction_start() +
JumpTableAssembler::LazyCompileSlotIndexToOffset(slot_index);
base::MutexGuard guard(&allocation_mutex_);
PatchJumpTablesLocked(func_index, lazy_compile_target);
JumpTableAssembler::PatchJumpTableSlot(main_jump_table_->instruction_start(),
slot_index, lazy_compile_target,
WasmCode::kFlushICache);
}
// TODO(mstarzinger): Remove {Isolate} parameter once {V8_EMBEDDED_BUILTINS}
......@@ -1035,7 +1035,9 @@ WasmCode* NativeModule::PublishCodeLocked(std::unique_ptr<WasmCode> code) {
}
if (update_jump_table) {
PatchJumpTablesLocked(code->index(), code->instruction_start());
JumpTableAssembler::PatchJumpTableSlot(
main_jump_table_->instruction_start(), slot_idx,
code->instruction_start(), WasmCode::kFlushICache);
}
}
WasmCodeRefScope::AddRef(code.get());
......@@ -1129,19 +1131,6 @@ WasmCode* NativeModule::CreateEmptyJumpTableInRegion(
return PublishCode(std::move(code));
}
void NativeModule::PatchJumpTablesLocked(uint32_t func_index, Address target) {
// The caller must hold the {allocation_mutex_}, thus we fail to lock it here.
DCHECK(!allocation_mutex_.TryLock());
uint32_t slot_index = func_index - module_->num_imported_functions;
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);
}
}
void NativeModule::AddCodeSpace(base::AddressRegion region) {
// Each code space must be at least twice as large as the overhead per code
// space. Otherwise, we are wasting too much memory.
......
......@@ -529,9 +529,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
WasmCode* CreateEmptyJumpTableInRegion(uint32_t jump_table_size,
base::AddressRegion);
// Hold the {allocation_mutex_} when calling this method.
void PatchJumpTablesLocked(uint32_t func_index, Address target);
// Called by the {WasmCodeAllocator} to register a new code space.
void AddCodeSpace(base::AddressRegion);
......
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