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, ...@@ -438,9 +438,7 @@ RelocIterator::RelocIterator(Vector<byte> instructions,
int mode_mask) int mode_mask)
: RelocIterator(nullptr, reinterpret_cast<Address>(instructions.start()), : RelocIterator(nullptr, reinterpret_cast<Address>(instructions.start()),
const_pool, reloc_info.start() + reloc_info.size(), const_pool, reloc_info.start() + reloc_info.size(),
reloc_info.start(), mode_mask) { reloc_info.start(), mode_mask) {}
rinfo_.flags_ = RelocInfo::kInNativeWasmCode;
}
RelocIterator::RelocIterator(Code* host, Address pc, Address constant_pool, RelocIterator::RelocIterator(Code* host, Address pc, Address constant_pool,
const byte* pos, const byte* end, int mode_mask) const byte* pos, const byte* end, int mode_mask)
...@@ -586,9 +584,6 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT ...@@ -586,9 +584,6 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
<< ")"; << ")";
} else if (IsCodeTarget(rmode_)) { } else if (IsCodeTarget(rmode_)) {
const Address code_target = target_address(); const Address code_target = target_address();
if (flags_ & kInNativeWasmCode) {
os << " (wasm trampoline) ";
} else {
Code* code = Code::GetCodeFromTargetAddress(code_target); Code* code = Code::GetCodeFromTargetAddress(code_target);
DCHECK(code->IsCode()); DCHECK(code->IsCode());
os << " (" << Code::Kind2String(code->kind()); os << " (" << Code::Kind2String(code->kind());
...@@ -598,7 +593,6 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT ...@@ -598,7 +593,6 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
os << " " << CodeStub::MajorName(CodeStub::GetMajorKey(code)); os << " " << CodeStub::MajorName(CodeStub::GetMajorKey(code));
} }
os << ") "; os << ") ";
}
os << " (" << reinterpret_cast<const void*>(target_address()) << ")"; os << " (" << reinterpret_cast<const void*>(target_address()) << ")";
} else if (IsRuntimeEntry(rmode_) && isolate->deoptimizer_data() != nullptr) { } else if (IsRuntimeEntry(rmode_) && isolate->deoptimizer_data() != nullptr) {
// Depotimization bailouts are stored as runtime entries. // Depotimization bailouts are stored as runtime entries.
......
...@@ -407,12 +407,6 @@ enum ICacheFlushMode { FLUSH_ICACHE_IF_NEEDED, SKIP_ICACHE_FLUSH }; ...@@ -407,12 +407,6 @@ enum ICacheFlushMode { FLUSH_ICACHE_IF_NEEDED, SKIP_ICACHE_FLUSH };
class RelocInfo { class RelocInfo {
public: 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 // 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 // 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 // lazy deoptimization. This is the case if we have indirect calls for which
...@@ -430,8 +424,8 @@ class RelocInfo { ...@@ -430,8 +424,8 @@ class RelocInfo {
static const int kMaxSmallPCDelta; static const int kMaxSmallPCDelta;
enum Mode : int8_t { enum Mode : int8_t {
// Please note the order is important (see IsRealRelocMode, IsCodeTarget, // Please note the order is important (see IsRealRelocMode, IsGCRelocMode,
// IsGCRelocMode, and IsShareableRelocMode predicates below). // and IsShareableRelocMode predicates below).
CODE_TARGET, CODE_TARGET,
EMBEDDED_OBJECT, // LAST_GCED_ENUM EMBEDDED_OBJECT, // LAST_GCED_ENUM
...@@ -495,12 +489,12 @@ class RelocInfo { ...@@ -495,12 +489,12 @@ class RelocInfo {
static inline bool IsRealRelocMode(Mode mode) { static inline bool IsRealRelocMode(Mode mode) {
return mode >= FIRST_REAL_RELOC_MODE && mode <= LAST_REAL_RELOC_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? // Is the relocation mode affected by GC?
static inline bool IsGCRelocMode(Mode mode) { return mode <= LAST_GCED_ENUM; } static inline bool IsGCRelocMode(Mode mode) { return mode <= LAST_GCED_ENUM; }
static inline bool IsShareableRelocMode(Mode mode) { static inline bool IsShareableRelocMode(Mode mode) {
return mode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE; return mode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE;
} }
static inline bool IsCodeTarget(Mode mode) { return mode == CODE_TARGET; }
static inline bool IsEmbeddedObject(Mode mode) { static inline bool IsEmbeddedObject(Mode mode) {
return mode == EMBEDDED_OBJECT; return mode == EMBEDDED_OBJECT;
} }
...@@ -687,7 +681,6 @@ class RelocInfo { ...@@ -687,7 +681,6 @@ class RelocInfo {
intptr_t data_ = 0; intptr_t data_ = 0;
Code* host_; Code* host_;
Address constant_pool_ = kNullAddress; Address constant_pool_ = kNullAddress;
Flags flags_;
friend class RelocIterator; friend class RelocIterator;
}; };
......
...@@ -134,15 +134,6 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate, ...@@ -134,15 +134,6 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
out->AddFormatted(" ;; external reference (%s)", reference_name); out->AddFormatted(" ;; external reference (%s)", reference_name);
} else if (RelocInfo::IsCodeTarget(rmode)) { } else if (RelocInfo::IsCodeTarget(rmode)) {
out->AddFormatted(" ;; code:"); 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()));
} else {
Code* code = Code::GetCodeFromTargetAddress(relocinfo->target_address()); Code* code = Code::GetCodeFromTargetAddress(relocinfo->target_address());
Code::Kind kind = code->kind(); Code::Kind kind = code->kind();
if (kind == Code::STUB) { if (kind == Code::STUB) {
...@@ -155,12 +146,10 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate, ...@@ -155,12 +146,10 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
CodeStub::MajorName(major_key)); CodeStub::MajorName(major_key));
out->AddFormatted("minor: %d", minor_key); out->AddFormatted("minor: %d", minor_key);
} else if (code->is_builtin()) { } else if (code->is_builtin()) {
out->AddFormatted(" Builtin::%s", out->AddFormatted(" Builtin::%s", Builtins::name(code->builtin_index()));
Builtins::name(code->builtin_index()));
} else { } else {
out->AddFormatted(" %s", Code::Kind2String(kind)); out->AddFormatted(" %s", Code::Kind2String(kind));
} }
}
} else if (RelocInfo::IsRuntimeEntry(rmode) && isolate && } else if (RelocInfo::IsRuntimeEntry(rmode) && isolate &&
isolate->deoptimizer_data() != nullptr) { isolate->deoptimizer_data() != nullptr) {
// A runtime entry reloinfo might be a deoptimization bailout-> // A runtime entry reloinfo might be a deoptimization bailout->
......
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