Commit 5095a6f5 authored by yangguo's avatar yangguo Committed by Commit bot

Fix RelocInfo::Mode enum wrt LAST_STANDARD_NONCOMPACT_ENUM.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/1011613003

Cr-Commit-Position: refs/heads/master@{#27216}
parent 5977ed02
......@@ -292,11 +292,6 @@ int Label::pos() const {
// (Bits 6..31 of pc delta, with leading zeroes
// dropped, and last non-zero chunk tagged with 1.)
#ifdef DEBUG
const int kMaxStandardNonCompactModes = 14;
#endif
const int kTagBits = 2;
const int kTagMask = (1 << kTagBits) - 1;
const int kExtraTagBits = 4;
......@@ -452,8 +447,6 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
#endif
DCHECK(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES);
DCHECK(rinfo->pc() - last_pc_ >= 0);
DCHECK(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM
<= kMaxStandardNonCompactModes);
// Use unsigned delta-encoding for pc.
uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
......@@ -511,10 +504,14 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
: kVeneerPoolTag);
} else {
DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM);
DCHECK(rmode <= RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM);
STATIC_ASSERT(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM -
RelocInfo::LAST_COMPACT_ENUM <=
kPoolExtraTag);
int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM - 1;
// For all other modes we simply use the mode as the extra tag.
// None of these modes need a data component.
DCHECK(saved_mode < kPoolExtraTag);
DCHECK(0 <= saved_mode && saved_mode < kPoolExtraTag);
WriteExtraTaggedPC(pc_delta, saved_mode);
}
last_pc_ = rinfo->pc();
......
......@@ -405,7 +405,7 @@ class RelocInfo {
LAST_GCED_ENUM = CELL,
// Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding.
LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID,
LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE
LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE_ENCODED
};
RelocInfo() {}
......
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