[assembler] Unify RelocInfo::NONE32 and NONE64

This reloc mode is never encoded, so there is no reason to
differentiate between 32 and 64 bit.
Both are now replaced by RelocInfo::NONE.

R=mstarzinger@chromium.org

Change-Id: I054d99c7dc41f99729fa33617a6f47301b4a31e7
Reviewed-on: https://chromium-review.googlesource.com/878401
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50763}
This commit is contained in:
Clemens Hammacher 2018-01-22 15:04:45 +01:00 committed by Commit Bot
parent efc3f5ff5a
commit d3a4d15f5e
23 changed files with 47 additions and 108 deletions

View File

@ -189,7 +189,7 @@ Operand::Operand(const ExternalReference& f)
value_.immediate = reinterpret_cast<int32_t>(f.address());
}
Operand::Operand(Smi* value) : rmode_(RelocInfo::NONE32) {
Operand::Operand(Smi* value) : rmode_(RelocInfo::NONE) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}

View File

@ -5153,8 +5153,7 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
void Assembler::ConstantPoolAddEntry(int position, RelocInfo::Mode rmode,
intptr_t value) {
DCHECK(rmode != RelocInfo::COMMENT && rmode != RelocInfo::CONST_POOL &&
rmode != RelocInfo::NONE64);
DCHECK(rmode != RelocInfo::COMMENT && rmode != RelocInfo::CONST_POOL);
bool sharing_ok = RelocInfo::IsNone(rmode) ||
(rmode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE);
DCHECK_LT(pending_32_bit_constants_.size(), kMaxNumPending32Constants);

View File

@ -376,7 +376,7 @@ class Operand BASE_EMBEDDED {
public:
// immediate
INLINE(explicit Operand(int32_t immediate,
RelocInfo::Mode rmode = RelocInfo::NONE32));
RelocInfo::Mode rmode = RelocInfo::NONE));
INLINE(static Operand Zero());
INLINE(explicit Operand(const ExternalReference& f));
explicit Operand(Handle<HeapObject> handle);

View File

@ -198,9 +198,7 @@ inline VRegister CPURegister::Q() const {
template<typename T>
struct ImmediateInitializer {
static const bool kIsIntType = true;
static inline RelocInfo::Mode rmode_for(T) {
return sizeof(T) == 8 ? RelocInfo::NONE64 : RelocInfo::NONE32;
}
static inline RelocInfo::Mode rmode_for(T) { return RelocInfo::NONE; }
static inline int64_t immediate_for(T t) {
STATIC_ASSERT(sizeof(T) <= 8);
return t;
@ -211,9 +209,7 @@ struct ImmediateInitializer {
template<>
struct ImmediateInitializer<Smi*> {
static const bool kIsIntType = false;
static inline RelocInfo::Mode rmode_for(Smi* t) {
return RelocInfo::NONE64;
}
static inline RelocInfo::Mode rmode_for(Smi* t) { return RelocInfo::NONE; }
static inline int64_t immediate_for(Smi* t) {;
return reinterpret_cast<int64_t>(t);
}

View File

@ -467,9 +467,6 @@ void ConstPool::Clear() {
bool ConstPool::CanBeShared(RelocInfo::Mode mode) {
// Constant pool currently does not support 32-bit entries.
DCHECK(mode != RelocInfo::NONE32);
return RelocInfo::IsNone(mode) ||
(mode >= RelocInfo::FIRST_SHAREABLE_RELOC_MODE);
}

View File

@ -1868,13 +1868,10 @@ void TurboAssembler::Call(Address target, RelocInfo::Mode rmode) {
Bind(&start_call);
#endif
// Addresses always have 64 bits, so we shouldn't encounter NONE32.
DCHECK(rmode != RelocInfo::NONE32);
UseScratchRegisterScope temps(this);
Register temp = temps.AcquireX();
if (rmode == RelocInfo::NONE64) {
if (RelocInfo::IsNone(rmode)) {
// Addresses are 48 bits so we never need to load the upper 16 bits.
uint64_t imm = reinterpret_cast<uint64_t>(target);
// If we don't use ARM tagged addresses, the 16 higher bits must be 0.
@ -1950,27 +1947,15 @@ int TurboAssembler::CallSize(Label* target) {
int TurboAssembler::CallSize(Address target, RelocInfo::Mode rmode) {
USE(target);
// Addresses always have 64 bits, so we shouldn't encounter NONE32.
DCHECK(rmode != RelocInfo::NONE32);
if (rmode == RelocInfo::NONE64) {
return kCallSizeWithoutRelocation;
} else {
return kCallSizeWithRelocation;
}
return RelocInfo::IsNone(rmode) ? kCallSizeWithoutRelocation
: kCallSizeWithRelocation;
}
int TurboAssembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode) {
USE(code);
// Addresses always have 64 bits, so we shouldn't encounter NONE32.
DCHECK(rmode != RelocInfo::NONE32);
if (rmode == RelocInfo::NONE64) {
return kCallSizeWithoutRelocation;
} else {
return kCallSizeWithRelocation;
}
return RelocInfo::IsNone(rmode) ? kCallSizeWithoutRelocation
: kCallSizeWithRelocation;
}

View File

@ -616,10 +616,8 @@ bool RelocInfo::RequiresRelocation(Isolate* isolate, const CodeDesc& desc) {
#ifdef ENABLE_DISASSEMBLER
const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
switch (rmode) {
case NONE32:
return "no reloc 32";
case NONE64:
return "no reloc 64";
case NONE:
return "no reloc";
case EMBEDDED_OBJECT:
return "embedded object";
case CODE_TARGET:
@ -745,8 +743,7 @@ void RelocInfo::Verify(Isolate* isolate) {
case WASM_GLOBAL_HANDLE:
case WASM_CALL:
case JS_TO_WASM_CALL:
case NONE32:
case NONE64:
case NONE:
break;
case NUMBER_OF_MODES:
case PC_JUMP:

View File

@ -401,8 +401,7 @@ class RelocInfo {
// Pseudo-types
NUMBER_OF_MODES,
NONE32, // never recorded 32-bit value
NONE64, // never recorded 64-bit value
NONE, // never recorded value
FIRST_REAL_RELOC_MODE = CODE_TARGET,
LAST_REAL_RELOC_MODE = VENEER_POOL,
@ -462,9 +461,7 @@ class RelocInfo {
static inline bool IsInternalReferenceEncoded(Mode mode) {
return mode == INTERNAL_REFERENCE_ENCODED;
}
static inline bool IsNone(Mode mode) {
return mode == NONE32 || mode == NONE64;
}
static inline bool IsNone(Mode mode) { return mode == NONE; }
static inline bool IsWasmContextReference(Mode mode) {
return mode == WASM_CONTEXT_REFERENCE;
}

View File

@ -1093,11 +1093,7 @@ class V8_EXPORT_PRIVATE Constant final {
private:
Type type_;
#if V8_TARGET_ARCH_32_BIT
RelocInfo::Mode rmode_ = RelocInfo::NONE32;
#else
RelocInfo::Mode rmode_ = RelocInfo::NONE64;
#endif
RelocInfo::Mode rmode_ = RelocInfo::NONE;
int64_t value_;
};

View File

@ -267,7 +267,7 @@ static int DecodeIt(Isolate* isolate, std::ostream* os,
// already, check if we can find some RelocInfo for the target address in
// the constant pool.
if (pcs.empty() && converter.code() != nullptr) {
RelocInfo dummy_rinfo(prev_pc, RelocInfo::NONE32, 0, nullptr);
RelocInfo dummy_rinfo(prev_pc, RelocInfo::NONE, 0, nullptr);
if (dummy_rinfo.IsInConstantPool()) {
byte* constant_pool_entry_address =
dummy_rinfo.constant_pool_entry_address();

View File

@ -233,7 +233,7 @@ enum RoundingMode {
class Immediate BASE_EMBEDDED {
public:
inline explicit Immediate(int x, RelocInfo::Mode rmode = RelocInfo::NONE32) {
inline explicit Immediate(int x, RelocInfo::Mode rmode = RelocInfo::NONE) {
value_.immediate = x;
rmode_ = rmode;
}
@ -244,7 +244,7 @@ class Immediate BASE_EMBEDDED {
inline explicit Immediate(Smi* value)
: Immediate(reinterpret_cast<intptr_t>(value)) {}
inline explicit Immediate(Address addr,
RelocInfo::Mode rmode = RelocInfo::NONE32)
RelocInfo::Mode rmode = RelocInfo::NONE)
: Immediate(reinterpret_cast<int32_t>(addr), rmode) {}
static Immediate EmbeddedNumber(double number); // Smi or HeapNumber.
@ -345,20 +345,15 @@ class Operand BASE_EMBEDDED {
// [base + disp/r]
explicit Operand(Register base, int32_t disp,
RelocInfo::Mode rmode = RelocInfo::NONE32);
RelocInfo::Mode rmode = RelocInfo::NONE);
// [base + index*scale + disp/r]
explicit Operand(Register base,
Register index,
ScaleFactor scale,
int32_t disp,
RelocInfo::Mode rmode = RelocInfo::NONE32);
explicit Operand(Register base, Register index, ScaleFactor scale,
int32_t disp, RelocInfo::Mode rmode = RelocInfo::NONE);
// [index*scale + disp/r]
explicit Operand(Register index,
ScaleFactor scale,
int32_t disp,
RelocInfo::Mode rmode = RelocInfo::NONE32);
explicit Operand(Register index, ScaleFactor scale, int32_t disp,
RelocInfo::Mode rmode = RelocInfo::NONE);
static Operand JumpTable(Register index, ScaleFactor scale, Label* table) {
return Operand(index, scale, reinterpret_cast<int32_t>(table),

View File

@ -388,7 +388,7 @@ class Operand BASE_EMBEDDED {
public:
// Immediate.
INLINE(explicit Operand(int32_t immediate,
RelocInfo::Mode rmode = RelocInfo::NONE32))
RelocInfo::Mode rmode = RelocInfo::NONE))
: rm_(no_reg), rmode_(rmode) {
value_.immediate = immediate;
}
@ -400,8 +400,7 @@ class Operand BASE_EMBEDDED {
INLINE(explicit Operand(Object** opp));
INLINE(explicit Operand(Context** cpp));
explicit Operand(Handle<HeapObject> handle);
INLINE(explicit Operand(Smi* value))
: rm_(no_reg), rmode_(RelocInfo::NONE32) {
INLINE(explicit Operand(Smi* value)) : rm_(no_reg), rmode_(RelocInfo::NONE) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}

View File

@ -396,7 +396,7 @@ class Operand BASE_EMBEDDED {
public:
// Immediate.
INLINE(explicit Operand(int64_t immediate,
RelocInfo::Mode rmode = RelocInfo::NONE64))
RelocInfo::Mode rmode = RelocInfo::NONE))
: rm_(no_reg), rmode_(rmode) {
value_.immediate = immediate;
}
@ -408,8 +408,7 @@ class Operand BASE_EMBEDDED {
INLINE(explicit Operand(Object** opp));
INLINE(explicit Operand(Context** cpp));
explicit Operand(Handle<HeapObject> handle);
INLINE(explicit Operand(Smi* value))
: rm_(no_reg), rmode_(RelocInfo::NONE32) {
INLINE(explicit Operand(Smi* value)) : rm_(no_reg), rmode_(RelocInfo::NONE) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}

View File

@ -373,18 +373,12 @@ C_REGISTERS(DECLARE_C_REGISTER)
// -----------------------------------------------------------------------------
// Machine instruction Operands
#if V8_TARGET_ARCH_PPC64
constexpr RelocInfo::Mode kRelocInfo_NONEPTR = RelocInfo::NONE64;
#else
constexpr RelocInfo::Mode kRelocInfo_NONEPTR = RelocInfo::NONE32;
#endif
// Class Operand represents a shifter operand in data processing instructions
class Operand BASE_EMBEDDED {
public:
// immediate
INLINE(explicit Operand(intptr_t immediate,
RelocInfo::Mode rmode = kRelocInfo_NONEPTR)
RelocInfo::Mode rmode = RelocInfo::NONE)
: rmode_(rmode)) {
value_.immediate = immediate;
}
@ -394,7 +388,7 @@ class Operand BASE_EMBEDDED {
value_.immediate = reinterpret_cast<intptr_t>(f.address());
}
explicit Operand(Handle<HeapObject> handle);
INLINE(explicit Operand(Smi* value) : rmode_(kRelocInfo_NONEPTR)) {
INLINE(explicit Operand(Smi* value) : rmode_(RelocInfo::NONE)) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}
// rm

View File

@ -345,12 +345,6 @@ C_REGISTERS(DECLARE_C_REGISTER)
// -----------------------------------------------------------------------------
// Machine instruction Operands
#if V8_TARGET_ARCH_S390X
constexpr RelocInfo::Mode kRelocInfo_NONEPTR = RelocInfo::NONE64;
#else
constexpr RelocInfo::Mode kRelocInfo_NONEPTR = RelocInfo::NONE32;
#endif
// Class Operand represents a shifter operand in data processing instructions
// defining immediate numbers and masks
typedef uint8_t Length;
@ -369,7 +363,7 @@ class Operand BASE_EMBEDDED {
public:
// immediate
INLINE(explicit Operand(intptr_t immediate,
RelocInfo::Mode rmode = kRelocInfo_NONEPTR)
RelocInfo::Mode rmode = RelocInfo::NONE)
: rmode_(rmode)) {
value_.immediate = immediate;
}
@ -379,7 +373,7 @@ class Operand BASE_EMBEDDED {
value_.immediate = reinterpret_cast<intptr_t>(f.address());
}
explicit Operand(Handle<HeapObject> handle);
INLINE(explicit Operand(Smi* value) : rmode_(kRelocInfo_NONEPTR)) {
INLINE(explicit Operand(Smi* value) : rmode_(RelocInfo::NONE)) {
value_.immediate = reinterpret_cast<intptr_t>(value);
}

View File

@ -283,7 +283,7 @@ class LiftoffAssembler : public TurboAssembler {
inline void ReserveStackSpace(uint32_t bytes);
inline void LoadConstant(LiftoffRegister, WasmValue,
RelocInfo::Mode rmode = RelocInfo::NONE32);
RelocInfo::Mode rmode = RelocInfo::NONE);
inline void LoadFromContext(Register dst, uint32_t offset, int size);
inline void SpillContext(Register context);
inline void FillContextInto(Register dst);

View File

@ -316,7 +316,7 @@ class Immediate BASE_EMBEDDED {
private:
int32_t value_;
RelocInfo::Mode rmode_ = RelocInfo::NONE32;
RelocInfo::Mode rmode_ = RelocInfo::NONE;
friend class Assembler;
};
@ -494,15 +494,6 @@ class Assembler : public AssemblerBase {
Isolate* isolate, Address pc, Address target,
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
static inline RelocInfo::Mode RelocInfoNone() {
if (kPointerSize == kInt64Size) {
return RelocInfo::NONE64;
} else {
DCHECK_EQ(kPointerSize, kInt32Size);
return RelocInfo::NONE32;
}
}
inline Handle<Code> code_target_object_handle_at(Address pc);
inline Address runtime_entry_at(Address pc);
// Number of bytes taken up by the branch target in the code.
@ -667,9 +658,9 @@ class Assembler : public AssemblerBase {
// Loads a 64-bit immediate into a register.
void movq(Register dst, int64_t value,
RelocInfo::Mode rmode = RelocInfo::NONE64);
RelocInfo::Mode rmode = RelocInfo::NONE);
void movq(Register dst, uint64_t value,
RelocInfo::Mode rmode = RelocInfo::NONE64);
RelocInfo::Mode rmode = RelocInfo::NONE);
void movsxbl(Register dst, Register src);
void movsxbl(Register dst, const Operand& src);

View File

@ -609,7 +609,7 @@ void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
// Call the entry hook function.
__ Move(rax, FUNCTION_ADDR(isolate()->function_entry_hook()),
Assembler::RelocInfoNone());
RelocInfo::NONE);
AllowExternalCallThatCantCauseGC scope(masm);

View File

@ -186,7 +186,7 @@ void MacroAssembler::PushAddress(ExternalReference source) {
int64_t address = reinterpret_cast<int64_t>(source.address());
if (is_int32(address) && !serializer_enabled()) {
if (emit_debug_code()) {
Move(kScratchRegister, kZapValue, Assembler::RelocInfoNone());
Move(kScratchRegister, kZapValue, RelocInfo::NONE);
}
Push(Immediate(static_cast<int32_t>(address)));
return;
@ -255,8 +255,8 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
Move(value, kZapValue, Assembler::RelocInfoNone());
Move(dst, kZapValue, Assembler::RelocInfoNone());
Move(value, kZapValue, RelocInfo::NONE);
Move(dst, kZapValue, RelocInfo::NONE);
}
}
@ -386,8 +386,8 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
Move(address, kZapValue, Assembler::RelocInfoNone());
Move(value, kZapValue, Assembler::RelocInfoNone());
Move(address, kZapValue, RelocInfo::NONE);
Move(value, kZapValue, RelocInfo::NONE);
}
}
@ -917,7 +917,7 @@ void TurboAssembler::Move(Register dst, Smi* source) {
if (value == 0) {
xorl(dst, dst);
} else {
Move(dst, source, Assembler::RelocInfoNone());
Move(dst, source, RelocInfo::NONE);
}
}

View File

@ -15080,7 +15080,7 @@ TEST(call_no_relocation) {
{
Assembler::BlockConstPoolScope scope(&masm);
call_start = buf + __ pc_offset();
__ Call(buf + function.pos(), RelocInfo::NONE64);
__ Call(buf + function.pos(), RelocInfo::NONE);
return_address = buf + __ pc_offset();
}
__ Pop(xzr, lr);

View File

@ -220,7 +220,7 @@ TEST(AssemblerIa325) {
v8::internal::byte buffer[256];
Assembler assm(isolate, buffer, sizeof buffer);
__ mov(eax, Operand(reinterpret_cast<intptr_t>(&baz), RelocInfo::NONE32));
__ mov(eax, Operand(reinterpret_cast<intptr_t>(&baz), RelocInfo::NONE));
__ ret(0);
CodeDesc desc;

View File

@ -69,7 +69,7 @@ TEST(DisasmIa320) {
// ---- All instructions that I can think of
__ add(edx, ebx);
__ add(edx, Operand(12, RelocInfo::NONE32));
__ add(edx, Operand(12, RelocInfo::NONE));
__ add(edx, Operand(ebx, 0));
__ add(edx, Operand(ebx, 16));
__ add(edx, Operand(ebx, 1999));

View File

@ -492,7 +492,7 @@ TEST(OperandOffset) {
__ leaq(r13, Operand(rbp, -3 * kPointerSize));
__ leaq(rbx, Operand(rbp, -5 * kPointerSize));
__ movl(rcx, Immediate(2));
__ Move(r8, reinterpret_cast<Address>(&data[128]), RelocInfo::NONE64);
__ Move(r8, reinterpret_cast<Address>(&data[128]), RelocInfo::NONE);
__ movl(rax, Immediate(1));
Operand sp0 = Operand(rsp, 0);