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

Unified Diff: src/compiler/schedule.cc

Issue 865393004: [turbofan] Move GetCommonDominator to BasicBlock. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/compiler/schedule.h ('k') | src/compiler/scheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/schedule.cc
diff --git a/src/compiler/schedule.cc b/src/compiler/schedule.cc
index 0622386400c66af3994fddc850be0db93ff572f3..b95626113d6d16944db00447eb760128488b0b36 100644
--- a/src/compiler/schedule.cc
+++ b/src/compiler/schedule.cc
@@ -18,13 +18,13 @@ BasicBlock::BasicBlock(Zone* zone, Id id)
rpo_number_(-1),
deferred_(false),
dominator_depth_(-1),
- dominator_(NULL),
- rpo_next_(NULL),
- loop_header_(NULL),
- loop_end_(NULL),
+ dominator_(nullptr),
+ rpo_next_(nullptr),
+ loop_header_(nullptr),
+ loop_end_(nullptr),
loop_depth_(0),
control_(kNone),
- control_input_(NULL),
+ control_input_(nullptr),
nodes_(zone),
successors_(zone),
predecessors_(zone),
@@ -82,6 +82,19 @@ void BasicBlock::set_loop_header(BasicBlock* loop_header) {
}
+// static
+BasicBlock* BasicBlock::GetCommonDominator(BasicBlock* b1, BasicBlock* b2) {
+ while (b1 != b2) {
+ if (b1->dominator_depth() < b2->dominator_depth()) {
+ b2 = b2->dominator();
+ } else {
+ b1 = b1->dominator();
+ }
+ }
+ return b1;
+}
+
+
std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c) {
switch (c) {
case BasicBlock::kNone:
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698