[wasm] Remove dead handling of RUNTIME_ENTRY relocations.
The RelocInfo::RUNTIME_ENTRY relocation mode is only used for deopt points in JavaScript code and should never appear in WebAssembly code. R=titzer@chromium.org Change-Id: Ied1d61e2b1eb886565d13448442dd6a6ed35d3f0 Reviewed-on: https://chromium-review.googlesource.com/1070197 Reviewed-by: Ben Titzer <titzer@chromium.org> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#53340}
This commit is contained in:
parent
815f9461f7
commit
8ac37bc392
@ -255,6 +255,39 @@ void WasmCode::LogCode(Isolate* isolate) const {
|
||||
}
|
||||
}
|
||||
|
||||
void WasmCode::Validate() const {
|
||||
#ifdef DEBUG
|
||||
// We expect certain relocation info modes to never appear in {WasmCode}
|
||||
// objects or to be restricted to a small set of valid values. Hence the
|
||||
// iteration below does not use a mask, but visits all relocation data.
|
||||
for (RelocIterator it(instructions(), reloc_info(), constant_pool());
|
||||
!it.done(); it.next()) {
|
||||
RelocInfo::Mode mode = it.rinfo()->rmode();
|
||||
switch (mode) {
|
||||
case RelocInfo::CODE_TARGET:
|
||||
// TODO(mstarzinger): Validate that we go through a trampoline.
|
||||
case RelocInfo::WASM_CODE_TABLE_ENTRY:
|
||||
case RelocInfo::WASM_GLOBAL_HANDLE:
|
||||
case RelocInfo::WASM_CALL:
|
||||
case RelocInfo::JS_TO_WASM_CALL:
|
||||
case RelocInfo::EXTERNAL_REFERENCE:
|
||||
case RelocInfo::COMMENT:
|
||||
case RelocInfo::CONST_POOL:
|
||||
case RelocInfo::VENEER_POOL:
|
||||
// These are OK to appear.
|
||||
break;
|
||||
case RelocInfo::EMBEDDED_OBJECT: {
|
||||
HeapObject* o = it.rinfo()->target_object();
|
||||
DCHECK(o->IsUndefined(o->GetIsolate()) || o->IsNull(o->GetIsolate()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FATAL("Unexpected mode: %d", mode);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void WasmCode::Print(Isolate* isolate) const {
|
||||
OFStream os(stdout);
|
||||
Disassemble(nullptr, isolate, os);
|
||||
@ -550,7 +583,6 @@ WasmCode* NativeModule::AddCode(
|
||||
// TODO(mtrofin): this is a copy and paste from Code::CopyFrom.
|
||||
int mode_mask = RelocInfo::kCodeTargetMask |
|
||||
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
|
||||
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
|
||||
RelocInfo::kApplyMask;
|
||||
// Needed to find target_object and runtime_entry on X64
|
||||
|
||||
@ -570,10 +602,6 @@ WasmCode* NativeModule::AddCode(
|
||||
Code* code = Code::cast(*p);
|
||||
it.rinfo()->set_target_address(GetLocalAddressFor(handle(code)),
|
||||
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
} else if (RelocInfo::IsRuntimeEntry(mode)) {
|
||||
Address p = it.rinfo()->target_runtime_entry(origin);
|
||||
it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
intptr_t delta = ret->instructions().start() - desc.buffer;
|
||||
it.rinfo()->apply(delta);
|
||||
@ -583,6 +611,7 @@ WasmCode* NativeModule::AddCode(
|
||||
// made while iterating over the RelocInfo above.
|
||||
Assembler::FlushICache(ret->instructions().start(),
|
||||
ret->instructions().size());
|
||||
ret->Validate();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,7 @@ class V8_EXPORT_PRIVATE WasmCode final {
|
||||
// trap_handler_index.
|
||||
void RegisterTrapHandlerData();
|
||||
|
||||
void Validate() const;
|
||||
void Print(Isolate* isolate) const;
|
||||
void Disassemble(const char* name, Isolate* isolate, std::ostream& os,
|
||||
Address current_pc = kNullAddress) const;
|
||||
|
@ -316,7 +316,6 @@ void NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
|
||||
// Relocate the code.
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::WASM_CALL) |
|
||||
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
|
||||
RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE);
|
||||
RelocIterator orig_iter(code->instructions(), code->reloc_info(),
|
||||
code->constant_pool(), mask);
|
||||
@ -337,13 +336,6 @@ void NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
|
||||
uint32_t tag = wasm_targets_lookup_[orig_target];
|
||||
SetWasmCalleeTag(iter.rinfo(), tag);
|
||||
} break;
|
||||
case RelocInfo::RUNTIME_ENTRY: {
|
||||
Address orig_target = orig_iter.rinfo()->target_address();
|
||||
auto ref_iter = reference_table_lookup_.find(orig_target);
|
||||
DCHECK(ref_iter != reference_table_lookup_.end());
|
||||
uint32_t tag = ref_iter->second;
|
||||
SetWasmCalleeTag(iter.rinfo(), tag);
|
||||
} break;
|
||||
case RelocInfo::EXTERNAL_REFERENCE: {
|
||||
Address orig_target = orig_iter.rinfo()->target_external_reference();
|
||||
auto ref_iter = reference_table_lookup_.find(orig_target);
|
||||
@ -491,7 +483,6 @@ bool NativeModuleDeserializer::ReadCode(uint32_t fn_index, Reader* reader) {
|
||||
// now relocate the code
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
|
||||
RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
|
||||
RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
|
||||
RelocInfo::ModeMask(RelocInfo::WASM_CODE_TABLE_ENTRY);
|
||||
for (RelocIterator iter(ret->instructions(), ret->reloc_info(),
|
||||
@ -512,14 +503,6 @@ bool NativeModuleDeserializer::ReadCode(uint32_t fn_index, Reader* reader) {
|
||||
SKIP_ICACHE_FLUSH);
|
||||
break;
|
||||
}
|
||||
case RelocInfo::RUNTIME_ENTRY: {
|
||||
uint32_t tag = GetWasmCalleeTag(iter.rinfo());
|
||||
Address address =
|
||||
isolate_->heap()->external_reference_table()->address(tag);
|
||||
iter.rinfo()->set_target_runtime_entry(address, SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
break;
|
||||
}
|
||||
case RelocInfo::EXTERNAL_REFERENCE: {
|
||||
uint32_t tag = GetWasmCalleeTag(iter.rinfo());
|
||||
Address address =
|
||||
|
Loading…
Reference in New Issue
Block a user