Commit 3669ff29 authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Remove dead code from wasm-code-specialization

R=clemensh@chromium.org

Change-Id: I97cadf40e441c5d19a1ea9b03a5d2f04505f04c5
Reviewed-on: https://chromium-review.googlesource.com/964365Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51968}
parent 697d39ab
......@@ -55,16 +55,6 @@ class PatchDirectCallsHelper {
comp_mod->shared()->module()->functions[func_index].code.offset();
}
PatchDirectCallsHelper(NativeModule* native_module, Code* code)
: source_pos_it(code->SourcePositionTable()), decoder(nullptr, nullptr) {
FixedArray* deopt_data = code->deoptimization_data();
DCHECK_EQ(2, deopt_data->length());
WasmSharedModuleData* shared = native_module->compiled_module()->shared();
int func_index = Smi::ToInt(deopt_data->get(1));
func_bytes = shared->module_bytes()->GetChars() +
shared->module()->functions[func_index].code.offset();
}
SourcePositionTableIterator source_pos_it;
Decoder decoder;
const byte* func_bytes;
......@@ -88,12 +78,6 @@ void CodeSpecialization::RelocateDirectCalls(NativeModule* native_module) {
relocate_direct_calls_module_ = native_module;
}
void CodeSpecialization::RelocatePointer(Address old_ptr, Address new_ptr) {
DCHECK_EQ(0, pointers_to_relocate_.count(old_ptr));
DCHECK_EQ(0, pointers_to_relocate_.count(new_ptr));
pointers_to_relocate_.insert(std::make_pair(old_ptr, new_ptr));
}
bool CodeSpecialization::ApplyToWholeModule(NativeModule* native_module,
ICacheFlushMode icache_flush_mode) {
DisallowHeapAllocation no_gc;
......@@ -168,14 +152,12 @@ bool CodeSpecialization::ApplyToWasmCode(wasm::WasmCode* code,
DCHECK_EQ(wasm::WasmCode::kFunction, code->kind());
bool reloc_direct_calls = relocate_direct_calls_module_ != nullptr;
bool reloc_pointers = pointers_to_relocate_.size() > 0;
int reloc_mode = 0;
auto add_mode = [&reloc_mode](bool cond, RelocInfo::Mode mode) {
if (cond) reloc_mode |= RelocInfo::ModeMask(mode);
};
add_mode(reloc_direct_calls, RelocInfo::WASM_CALL);
add_mode(reloc_pointers, RelocInfo::WASM_GLOBAL_HANDLE);
base::Optional<PatchDirectCallsHelper> patch_direct_calls_helper;
bool changed = false;
......@@ -209,16 +191,6 @@ bool CodeSpecialization::ApplyToWasmCode(wasm::WasmCode* code,
icache_flush_mode);
changed = true;
} break;
case RelocInfo::WASM_GLOBAL_HANDLE: {
DCHECK(reloc_pointers);
Address old_ptr = it.rinfo()->global_handle();
auto entry = pointers_to_relocate_.find(old_ptr);
if (entry != pointers_to_relocate_.end()) {
Address new_ptr = entry->second;
it.rinfo()->set_global_handle(new_ptr, icache_flush_mode);
changed = true;
}
} break;
default:
UNREACHABLE();
}
......
......@@ -32,9 +32,6 @@ class CodeSpecialization {
void RelocateWasmContextReferences(Address new_context);
// Update all direct call sites based on the code table in the given instance.
void RelocateDirectCalls(NativeModule* module);
// Relocate an arbitrary object (e.g. function table).
void RelocatePointer(Address old_obj, Address new_obj);
// Apply all relocations and patching to all code in the instance (wasm code
// and exported functions).
bool ApplyToWholeModule(NativeModule*,
......@@ -47,8 +44,6 @@ class CodeSpecialization {
Address new_wasm_context_address_ = 0;
NativeModule* relocate_direct_calls_module_ = nullptr;
std::unordered_map<Address, Address> pointers_to_relocate_;
};
} // namespace wasm
......
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