Commit e465e7c2 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[assembler] Remove WebAssembly special case for RelocInfo.

This removes special casing in the handling of {RelocInfo::CODE_TARGET}
for cases where such references appeared in {WasmCode}. Such references
can only appear in real {Code} objects and also only target real {Code}
objects by now.

R=clemensh@chromium.org

Change-Id: I87c55c60cd6344bb67fa8c8d04b66fb523d07ba7
Reviewed-on: https://chromium-review.googlesource.com/1104680
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53848}
parent d5177a02
......@@ -438,9 +438,7 @@ RelocIterator::RelocIterator(Vector<byte> instructions,
int mode_mask)
: RelocIterator(nullptr, reinterpret_cast<Address>(instructions.start()),
const_pool, reloc_info.start() + reloc_info.size(),
reloc_info.start(), mode_mask) {
rinfo_.flags_ = RelocInfo::kInNativeWasmCode;
}
reloc_info.start(), mode_mask) {}
RelocIterator::RelocIterator(Code* host, Address pc, Address constant_pool,
const byte* pos, const byte* end, int mode_mask)
......@@ -586,19 +584,15 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
<< ")";
} else if (IsCodeTarget(rmode_)) {
const Address code_target = target_address();
if (flags_ & kInNativeWasmCode) {
os << " (wasm trampoline) ";
} else {
Code* code = Code::GetCodeFromTargetAddress(code_target);
DCHECK(code->IsCode());
os << " (" << Code::Kind2String(code->kind());
if (Builtins::IsBuiltin(code)) {
os << " " << Builtins::name(code->builtin_index());
} else if (code->kind() == Code::STUB) {
os << " " << CodeStub::MajorName(CodeStub::GetMajorKey(code));
}
os << ") ";
Code* code = Code::GetCodeFromTargetAddress(code_target);
DCHECK(code->IsCode());
os << " (" << Code::Kind2String(code->kind());
if (Builtins::IsBuiltin(code)) {
os << " " << Builtins::name(code->builtin_index());
} else if (code->kind() == Code::STUB) {
os << " " << CodeStub::MajorName(CodeStub::GetMajorKey(code));
}
os << ") ";
os << " (" << reinterpret_cast<const void*>(target_address()) << ")";
} else if (IsRuntimeEntry(rmode_) && isolate->deoptimizer_data() != nullptr) {
// Depotimization bailouts are stored as runtime entries.
......
......@@ -407,12 +407,6 @@ enum ICacheFlushMode { FLUSH_ICACHE_IF_NEEDED, SKIP_ICACHE_FLUSH };
class RelocInfo {
public:
enum Flag : uint8_t {
kNoFlags = 0,
kInNativeWasmCode = 1u << 0, // Reloc info belongs to native wasm code.
};
typedef base::Flags<Flag> Flags;
// This string is used to add padding comments to the reloc info in cases
// where we are not sure to have enough space for patching in during
// lazy deoptimization. This is the case if we have indirect calls for which
......@@ -430,8 +424,8 @@ class RelocInfo {
static const int kMaxSmallPCDelta;
enum Mode : int8_t {
// Please note the order is important (see IsRealRelocMode, IsCodeTarget,
// IsGCRelocMode, and IsShareableRelocMode predicates below).
// Please note the order is important (see IsRealRelocMode, IsGCRelocMode,
// and IsShareableRelocMode predicates below).
CODE_TARGET,
EMBEDDED_OBJECT, // LAST_GCED_ENUM
......@@ -495,12 +489,12 @@ class RelocInfo {
static inline bool IsRealRelocMode(Mode mode) {
return mode >= FIRST_REAL_RELOC_MODE && mode <= LAST_REAL_RELOC_MODE;
}
static inline bool IsCodeTarget(Mode mode) { return mode == CODE_TARGET; }
// Is the relocation mode affected by GC?
static inline bool IsGCRelocMode(Mode mode) { return mode <= LAST_GCED_ENUM; }
static inline bool IsShareableRelocMode(Mode mode) {
return mode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE;
}
static inline bool IsCodeTarget(Mode mode) { return mode == CODE_TARGET; }
static inline bool IsEmbeddedObject(Mode mode) {
return mode == EMBEDDED_OBJECT;
}
......@@ -687,7 +681,6 @@ class RelocInfo {
intptr_t data_ = 0;
Code* host_;
Address constant_pool_ = kNullAddress;
Flags flags_;
friend class RelocIterator;
};
......
......@@ -134,32 +134,21 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
out->AddFormatted(" ;; external reference (%s)", reference_name);
} else if (RelocInfo::IsCodeTarget(rmode)) {
out->AddFormatted(" ;; code:");
if (isolate == nullptr) {
// TODO(mstarzinger): get a useful WASM name if the isolate is null
out->AddFormatted(" (unknown)");
} else if (wasm::WasmCode* wasmCode =
isolate->wasm_engine()->code_manager()->LookupCode(
relocinfo->target_address())) {
out->AddFormatted(" wasm(%s)",
wasm::GetWasmCodeKindAsString(wasmCode->kind()));
Code* code = Code::GetCodeFromTargetAddress(relocinfo->target_address());
Code::Kind kind = code->kind();
if (kind == Code::STUB) {
// Get the STUB key and extract major and minor key.
uint32_t key = code->stub_key();
uint32_t minor_key = CodeStub::MinorKeyFromKey(key);
CodeStub::Major major_key = CodeStub::GetMajorKey(code);
DCHECK(major_key == CodeStub::MajorKeyFromKey(key));
out->AddFormatted(" %s, %s, ", Code::Kind2String(kind),
CodeStub::MajorName(major_key));
out->AddFormatted("minor: %d", minor_key);
} else if (code->is_builtin()) {
out->AddFormatted(" Builtin::%s", Builtins::name(code->builtin_index()));
} else {
Code* code = Code::GetCodeFromTargetAddress(relocinfo->target_address());
Code::Kind kind = code->kind();
if (kind == Code::STUB) {
// Get the STUB key and extract major and minor key.
uint32_t key = code->stub_key();
uint32_t minor_key = CodeStub::MinorKeyFromKey(key);
CodeStub::Major major_key = CodeStub::GetMajorKey(code);
DCHECK(major_key == CodeStub::MajorKeyFromKey(key));
out->AddFormatted(" %s, %s, ", Code::Kind2String(kind),
CodeStub::MajorName(major_key));
out->AddFormatted("minor: %d", minor_key);
} else if (code->is_builtin()) {
out->AddFormatted(" Builtin::%s",
Builtins::name(code->builtin_index()));
} else {
out->AddFormatted(" %s", Code::Kind2String(kind));
}
out->AddFormatted(" %s", Code::Kind2String(kind));
}
} else if (RelocInfo::IsRuntimeEntry(rmode) && isolate &&
isolate->deoptimizer_data() != nullptr) {
......
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