Remove enum RelocInfo::CODE_TARGET_WITH_ID.
RelocInfo no longer needs CODE_TARGET_WITH_ID thanks to the removal of Crankshaft. BUG=v8:6408 R=mstarzinger@chromium.org Review-Url: https://codereview.chromium.org/2951473002 Cr-Commit-Position: refs/heads/master@{#46047}
This commit is contained in:
parent
b102540e44
commit
b2b38f00c0
@ -4786,7 +4786,6 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
|
||||
return;
|
||||
}
|
||||
DCHECK(buffer_space() >= kMaxRelocSize); // too late to grow buffer here
|
||||
DCHECK(rmode != RelocInfo::CODE_TARGET_WITH_ID);
|
||||
reloc_info_writer.Write(&rinfo);
|
||||
}
|
||||
}
|
||||
|
@ -280,16 +280,12 @@ unsigned CpuFeatures::dcache_line_size_ = 0;
|
||||
// 01: code_target: [6-bit pc delta] 01
|
||||
//
|
||||
// 10: short_data_record: [6-bit pc delta] 10 followed by
|
||||
// [6-bit data delta] [2-bit data type tag]
|
||||
// [8-bit data delta]
|
||||
//
|
||||
// 11: long_record [6 bit reloc mode] 11
|
||||
// followed by pc delta
|
||||
// followed by optional data depending on type.
|
||||
//
|
||||
// 1-bit data type tags, used in short_data_record and data_jump long_record:
|
||||
// code_target_with_id: 0
|
||||
// deopt_reason: 1
|
||||
//
|
||||
// If a pc delta exceeds 6 bits, it is split into a remainder that fits into
|
||||
// 6 bits and a part that does not. The latter is encoded as a long record
|
||||
// with PC_JUMP as pseudo reloc info mode. The former is encoded as part of
|
||||
@ -305,8 +301,6 @@ unsigned CpuFeatures::dcache_line_size_ = 0;
|
||||
const int kTagBits = 2;
|
||||
const int kTagMask = (1 << kTagBits) - 1;
|
||||
const int kLongTagBits = 6;
|
||||
const int kShortDataTypeTagBits = 1;
|
||||
const int kShortDataBits = kBitsPerByte - kShortDataTypeTagBits;
|
||||
|
||||
const int kEmbeddedObjectTag = 0;
|
||||
const int kCodeTargetTag = 1;
|
||||
@ -323,9 +317,6 @@ const int kLastChunkTagBits = 1;
|
||||
const int kLastChunkTagMask = 1;
|
||||
const int kLastChunkTag = 1;
|
||||
|
||||
const int kCodeWithIdTag = 0;
|
||||
const int kDeoptReasonTag = 1;
|
||||
|
||||
void RelocInfo::update_wasm_memory_reference(
|
||||
Isolate* isolate, Address old_base, Address new_base,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
@ -411,9 +402,8 @@ void RelocInfoWriter::WriteShortTaggedPC(uint32_t pc_delta, int tag) {
|
||||
*--pos_ = pc_delta << kTagBits | tag;
|
||||
}
|
||||
|
||||
|
||||
void RelocInfoWriter::WriteShortTaggedData(intptr_t data_delta, int tag) {
|
||||
*--pos_ = static_cast<byte>(data_delta << kShortDataTypeTagBits | tag);
|
||||
void RelocInfoWriter::WriteShortData(intptr_t data_delta) {
|
||||
*--pos_ = static_cast<byte>(data_delta);
|
||||
}
|
||||
|
||||
|
||||
@ -465,24 +455,10 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
|
||||
} else if (rmode == RelocInfo::CODE_TARGET) {
|
||||
WriteShortTaggedPC(pc_delta, kCodeTargetTag);
|
||||
DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize);
|
||||
} else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
|
||||
// Use signed delta-encoding for id.
|
||||
DCHECK_EQ(static_cast<int>(rinfo->data()), rinfo->data());
|
||||
int id_delta = static_cast<int>(rinfo->data()) - last_id_;
|
||||
// Check if delta is small enough to fit in a tagged byte.
|
||||
if (is_intn(id_delta, kShortDataBits)) {
|
||||
WriteShortTaggedPC(pc_delta, kLocatableTag);
|
||||
WriteShortTaggedData(id_delta, kCodeWithIdTag);
|
||||
} else {
|
||||
// Otherwise, use costly encoding.
|
||||
WriteModeAndPC(pc_delta, rmode);
|
||||
WriteIntData(id_delta);
|
||||
}
|
||||
last_id_ = static_cast<int>(rinfo->data());
|
||||
} else if (rmode == RelocInfo::DEOPT_REASON) {
|
||||
DCHECK(rinfo->data() < (1 << kShortDataBits));
|
||||
DCHECK(rinfo->data() < (1 << kBitsPerByte));
|
||||
WriteShortTaggedPC(pc_delta, kLocatableTag);
|
||||
WriteShortTaggedData(rinfo->data(), kDeoptReasonTag);
|
||||
WriteShortData(rinfo->data());
|
||||
} else {
|
||||
WriteModeAndPC(pc_delta, rmode);
|
||||
if (RelocInfo::IsComment(rmode)) {
|
||||
@ -523,16 +499,6 @@ inline void RelocIterator::AdvanceReadPC() {
|
||||
}
|
||||
|
||||
|
||||
void RelocIterator::AdvanceReadId() {
|
||||
int x = 0;
|
||||
for (int i = 0; i < kIntSize; i++) {
|
||||
x |= static_cast<int>(*--pos_) << i * kBitsPerByte;
|
||||
}
|
||||
last_id_ += x;
|
||||
rinfo_.data_ = last_id_;
|
||||
}
|
||||
|
||||
|
||||
void RelocIterator::AdvanceReadInt() {
|
||||
int x = 0;
|
||||
for (int i = 0; i < kIntSize; i++) {
|
||||
@ -566,23 +532,9 @@ void RelocIterator::AdvanceReadLongPCJump() {
|
||||
rinfo_.pc_ += pc_jump << kSmallPCDeltaBits;
|
||||
}
|
||||
|
||||
|
||||
inline int RelocIterator::GetShortDataTypeTag() {
|
||||
return *pos_ & ((1 << kShortDataTypeTagBits) - 1);
|
||||
}
|
||||
|
||||
|
||||
inline void RelocIterator::ReadShortTaggedId() {
|
||||
int8_t signed_b = *pos_;
|
||||
// Signed right shift is arithmetic shift. Tested in test-utils.cc.
|
||||
last_id_ += signed_b >> kShortDataTypeTagBits;
|
||||
rinfo_.data_ = last_id_;
|
||||
}
|
||||
|
||||
|
||||
inline void RelocIterator::ReadShortTaggedData() {
|
||||
inline void RelocIterator::ReadShortData() {
|
||||
uint8_t unsigned_b = *pos_;
|
||||
rinfo_.data_ = unsigned_b >> kShortDataTypeTagBits;
|
||||
rinfo_.data_ = unsigned_b;
|
||||
}
|
||||
|
||||
|
||||
@ -604,18 +556,9 @@ void RelocIterator::next() {
|
||||
} else if (tag == kLocatableTag) {
|
||||
ReadShortTaggedPC();
|
||||
Advance();
|
||||
int data_type_tag = GetShortDataTypeTag();
|
||||
if (data_type_tag == kCodeWithIdTag) {
|
||||
if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) {
|
||||
ReadShortTaggedId();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
DCHECK(data_type_tag == kDeoptReasonTag);
|
||||
if (SetMode(RelocInfo::DEOPT_REASON)) {
|
||||
ReadShortTaggedData();
|
||||
return;
|
||||
}
|
||||
if (SetMode(RelocInfo::DEOPT_REASON)) {
|
||||
ReadShortData();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
DCHECK(tag == kDefaultTag);
|
||||
@ -624,13 +567,7 @@ void RelocIterator::next() {
|
||||
AdvanceReadLongPCJump();
|
||||
} else {
|
||||
AdvanceReadPC();
|
||||
if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
|
||||
if (SetMode(rmode)) {
|
||||
AdvanceReadId();
|
||||
return;
|
||||
}
|
||||
Advance(kIntSize);
|
||||
} else if (RelocInfo::IsComment(rmode)) {
|
||||
if (RelocInfo::IsComment(rmode)) {
|
||||
if (SetMode(rmode)) {
|
||||
AdvanceReadData();
|
||||
return;
|
||||
@ -673,7 +610,6 @@ RelocIterator::RelocIterator(Code* code, int mode_mask) {
|
||||
end_ = code->relocation_start();
|
||||
done_ = false;
|
||||
mode_mask_ = mode_mask;
|
||||
last_id_ = 0;
|
||||
byte* sequence = code->FindCodeAgeSequence();
|
||||
// We get the isolate from the map, because at serialization time
|
||||
// the code pointer has been cloned and isn't really in heap space.
|
||||
@ -695,7 +631,6 @@ RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) {
|
||||
end_ = pos_ - desc.reloc_size;
|
||||
done_ = false;
|
||||
mode_mask_ = mode_mask;
|
||||
last_id_ = 0;
|
||||
code_age_sequence_ = NULL;
|
||||
if (mode_mask_ == 0) pos_ = end_;
|
||||
next();
|
||||
@ -735,8 +670,6 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
|
||||
return "embedded object";
|
||||
case CODE_TARGET:
|
||||
return "code target";
|
||||
case CODE_TARGET_WITH_ID:
|
||||
return "code target with id";
|
||||
case CELL:
|
||||
return "property cell";
|
||||
case RUNTIME_ENTRY:
|
||||
@ -810,9 +743,6 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
Code* code = Code::GetCodeFromTargetAddress(target_address());
|
||||
os << " (" << Code::Kind2String(code->kind()) << ") ("
|
||||
<< static_cast<const void*>(target_address()) << ")";
|
||||
if (rmode_ == CODE_TARGET_WITH_ID) {
|
||||
os << " (id=" << static_cast<int>(data_) << ")";
|
||||
}
|
||||
} else if (IsRuntimeEntry(rmode_) &&
|
||||
isolate->deoptimizer_data() != NULL) {
|
||||
// Depotimization bailouts are stored as runtime entries.
|
||||
@ -839,7 +769,6 @@ void RelocInfo::Verify(Isolate* isolate) {
|
||||
case CELL:
|
||||
Object::VerifyPointer(target_cell());
|
||||
break;
|
||||
case CODE_TARGET_WITH_ID:
|
||||
case CODE_TARGET: {
|
||||
// convert inline target address to code object
|
||||
Address addr = target_address();
|
||||
|
@ -346,7 +346,6 @@ class RelocInfo {
|
||||
enum Mode {
|
||||
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
|
||||
CODE_TARGET,
|
||||
CODE_TARGET_WITH_ID,
|
||||
EMBEDDED_OBJECT,
|
||||
// Wasm entries are to relocate pointers into the wasm memory embedded in
|
||||
// wasm code. Everything after WASM_MEMORY_REFERENCE (inclusive) is not
|
||||
@ -396,7 +395,7 @@ class RelocInfo {
|
||||
|
||||
FIRST_REAL_RELOC_MODE = CODE_TARGET,
|
||||
LAST_REAL_RELOC_MODE = VENEER_POOL,
|
||||
LAST_CODE_ENUM = CODE_TARGET_WITH_ID,
|
||||
LAST_CODE_ENUM = CODE_TARGET,
|
||||
LAST_GCED_ENUM = EMBEDDED_OBJECT,
|
||||
FIRST_SHAREABLE_RELOC_MODE = CELL,
|
||||
};
|
||||
@ -642,7 +641,6 @@ class RelocInfo {
|
||||
#endif
|
||||
|
||||
static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1;
|
||||
static const int kDataMask = (1 << CODE_TARGET_WITH_ID) | (1 << COMMENT);
|
||||
static const int kDebugBreakSlotMask = 1 << DEBUG_BREAK_SLOT_AT_POSITION |
|
||||
1 << DEBUG_BREAK_SLOT_AT_RETURN |
|
||||
1 << DEBUG_BREAK_SLOT_AT_CALL;
|
||||
@ -670,8 +668,8 @@ class RelocInfo {
|
||||
// lower addresses.
|
||||
class RelocInfoWriter BASE_EMBEDDED {
|
||||
public:
|
||||
RelocInfoWriter() : pos_(NULL), last_pc_(NULL), last_id_(0) {}
|
||||
RelocInfoWriter(byte* pos, byte* pc) : pos_(pos), last_pc_(pc), last_id_(0) {}
|
||||
RelocInfoWriter() : pos_(NULL), last_pc_(NULL) {}
|
||||
RelocInfoWriter(byte* pos, byte* pc) : pos_(pos), last_pc_(pc) {}
|
||||
|
||||
byte* pos() const { return pos_; }
|
||||
byte* last_pc() const { return last_pc_; }
|
||||
@ -696,7 +694,7 @@ class RelocInfoWriter BASE_EMBEDDED {
|
||||
inline uint32_t WriteLongPCJump(uint32_t pc_delta);
|
||||
|
||||
inline void WriteShortTaggedPC(uint32_t pc_delta, int tag);
|
||||
inline void WriteShortTaggedData(intptr_t data_delta, int tag);
|
||||
inline void WriteShortData(intptr_t data_delta);
|
||||
|
||||
inline void WriteMode(RelocInfo::Mode rmode);
|
||||
inline void WriteModeAndPC(uint32_t pc_delta, RelocInfo::Mode rmode);
|
||||
@ -705,7 +703,6 @@ class RelocInfoWriter BASE_EMBEDDED {
|
||||
|
||||
byte* pos_;
|
||||
byte* last_pc_;
|
||||
int last_id_;
|
||||
RelocInfo::Mode last_mode_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter);
|
||||
@ -749,13 +746,10 @@ class RelocIterator: public Malloced {
|
||||
|
||||
void AdvanceReadLongPCJump();
|
||||
|
||||
int GetShortDataTypeTag();
|
||||
void ReadShortTaggedPC();
|
||||
void ReadShortTaggedId();
|
||||
void ReadShortTaggedData();
|
||||
void ReadShortData();
|
||||
|
||||
void AdvanceReadPC();
|
||||
void AdvanceReadId();
|
||||
void AdvanceReadInt();
|
||||
void AdvanceReadData();
|
||||
|
||||
@ -771,7 +765,6 @@ class RelocIterator: public Malloced {
|
||||
RelocInfo rinfo_;
|
||||
bool done_;
|
||||
int mode_mask_;
|
||||
int last_id_;
|
||||
DISALLOW_COPY_AND_ASSIGN(RelocIterator);
|
||||
};
|
||||
|
||||
|
@ -135,9 +135,6 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
|
||||
} else {
|
||||
out->AddFormatted(" %s", Code::Kind2String(kind));
|
||||
}
|
||||
if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
|
||||
out->AddFormatted(" (id = %d)", static_cast<int>(relocinfo->data()));
|
||||
}
|
||||
} else if (RelocInfo::IsRuntimeEntry(rmode) &&
|
||||
isolate->deoptimizer_data() != nullptr) {
|
||||
// A runtime entry reloinfo might be a deoptimization bailout->
|
||||
|
@ -3666,7 +3666,6 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
|
||||
return;
|
||||
}
|
||||
DCHECK(buffer_space() >= kMaxRelocSize); // Too late to grow buffer here.
|
||||
DCHECK(rmode != RelocInfo::CODE_TARGET_WITH_ID);
|
||||
reloc_info_writer.Write(&rinfo);
|
||||
}
|
||||
}
|
||||
|
@ -3925,7 +3925,6 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
|
||||
return;
|
||||
}
|
||||
DCHECK(buffer_space() >= kMaxRelocSize); // Too late to grow buffer here.
|
||||
DCHECK(rmode != RelocInfo::CODE_TARGET_WITH_ID);
|
||||
reloc_info_writer.Write(&rinfo);
|
||||
}
|
||||
}
|
||||
|
@ -13796,8 +13796,7 @@ void Code::FindAndReplace(const FindAndReplacePattern& pattern) {
|
||||
|
||||
|
||||
void Code::ClearInlineCaches() {
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET);
|
||||
for (RelocIterator it(this, mask); !it.done(); it.next()) {
|
||||
RelocInfo* info = it.rinfo();
|
||||
Code* target(Code::GetCodeFromTargetAddress(info->target_address()));
|
||||
|
21
src/utils.h
21
src/utils.h
@ -904,27 +904,6 @@ INT_1_TO_63_LIST(DECLARE_TRUNCATE_TO_INT_N)
|
||||
#undef DECLARE_IS_UINT_N
|
||||
#undef DECLARE_TRUNCATE_TO_INT_N
|
||||
|
||||
class TypeFeedbackId {
|
||||
public:
|
||||
explicit TypeFeedbackId(int id) : id_(id) { }
|
||||
int ToInt() const { return id_; }
|
||||
|
||||
static TypeFeedbackId None() { return TypeFeedbackId(kNoneId); }
|
||||
bool IsNone() const { return id_ == kNoneId; }
|
||||
|
||||
private:
|
||||
static const int kNoneId = -1;
|
||||
|
||||
int id_;
|
||||
};
|
||||
|
||||
inline bool operator<(TypeFeedbackId lhs, TypeFeedbackId rhs) {
|
||||
return lhs.ToInt() < rhs.ToInt();
|
||||
}
|
||||
inline bool operator>(TypeFeedbackId lhs, TypeFeedbackId rhs) {
|
||||
return lhs.ToInt() > rhs.ToInt();
|
||||
}
|
||||
|
||||
class FeedbackSlot {
|
||||
public:
|
||||
FeedbackSlot() : id_(kInvalidSlot) {}
|
||||
|
@ -3290,8 +3290,7 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
|
||||
|
||||
|
||||
static Code* FindFirstIC(Code* code, Code::Kind kind) {
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
|
||||
RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET);
|
||||
for (RelocIterator it(code, mask); !it.done(); it.next()) {
|
||||
RelocInfo* info = it.rinfo();
|
||||
Code* target = Code::GetCodeFromTargetAddress(info->target_address());
|
||||
|
Loading…
Reference in New Issue
Block a user