Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: src/assembler.cc

Issue 1011613003: Fix RelocInfo::Mode enum wrt LAST_STANDARD_NONCOMPACT_ENUM. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index a63ca3a4cf62e5538c00efc61980fd7460b2e70e..6e9f3f2f2c6be38ba7df36ebe0259a6842b4a595 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -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();
« no previous file with comments | « src/assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698