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

Unified Diff: src/compiler/register-allocator.cc

Issue 1533723002: [turbofan] More thorough validation of LiveRanges. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/compiler/register-allocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator.cc
diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc
index 05bc8ba795c1b46fd59b35f1463b5b999fbb12c0..7a6d42a84dbfb9b061232c971303333780573b2b 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -272,7 +272,7 @@ LiveRange::LiveRange(int relative_id, MachineRepresentation rep,
}
-void LiveRange::Verify() const {
+void LiveRange::VerifyPositions() const {
// Walk the positions, verifying that each is in an interval.
auto interval = first_interval_;
for (auto pos = first_pos_; pos != nullptr; pos = pos->next()) {
@@ -287,6 +287,18 @@ void LiveRange::Verify() const {
}
+void LiveRange::VerifyIntervals() const {
+ DCHECK(first_interval()->start() == Start());
+ LifetimePosition last_end = first_interval()->end();
+ for (UseInterval* interval = first_interval()->next(); interval != nullptr;
+ interval = interval->next()) {
+ DCHECK(last_end <= interval->start());
+ last_end = interval->end();
+ }
+ DCHECK(last_end == End());
+}
+
+
void LiveRange::set_assigned_register(int reg) {
DCHECK(!HasRegisterAssigned() && !spilled());
bits_ = AssignedRegisterField::update(bits_, reg);
@@ -527,8 +539,8 @@ UsePosition* LiveRange::DetachAt(LifetimePosition position, LiveRange* result,
size_ = kInvalidSize;
weight_ = kInvalidWeight;
#ifdef DEBUG
- Verify();
- result->Verify();
+ VerifyChildStructure();
+ result->VerifyChildStructure();
#endif
return use_before;
}
@@ -946,6 +958,24 @@ void TopLevelLiveRange::Merge(TopLevelLiveRange* other, Zone* zone) {
}
+void TopLevelLiveRange::VerifyChildrenInOrder() const {
+ LifetimePosition last_end = End();
+ for (const LiveRange* child = this->next(); child != nullptr;
+ child = child->next()) {
+ DCHECK(last_end <= child->Start());
+ last_end = child->End();
+ }
+}
+
+
+void TopLevelLiveRange::Verify() const {
+ VerifyChildrenInOrder();
+ for (const LiveRange* child = this; child != nullptr; child = child->next()) {
+ VerifyChildStructure();
+ }
+}
+
+
void TopLevelLiveRange::ShortenTo(LifetimePosition start) {
TRACE("Shorten live range %d to [%d\n", vreg(), start.value());
DCHECK(first_interval_ != nullptr);
@@ -2193,8 +2223,8 @@ void LiveRangeBuilder::Verify() const {
for (auto& hint : phi_hints_) {
CHECK(hint.second->IsResolved());
}
- for (LiveRange* current : data()->live_ranges()) {
- if (current != nullptr) current->Verify();
+ for (TopLevelLiveRange* current : data()->live_ranges()) {
+ if (current != nullptr && !current->IsEmpty()) current->Verify();
}
}
« no previous file with comments | « src/compiler/register-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698