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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/schedule.h" 5 #include "src/compiler/schedule.h"
6 6
7 #include "src/compiler/node.h" 7 #include "src/compiler/node.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/ostreams.h" 10 #include "src/ostreams.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 BasicBlock::BasicBlock(Zone* zone, Id id) 16 BasicBlock::BasicBlock(Zone* zone, Id id)
17 : loop_number_(-1), 17 : loop_number_(-1),
18 rpo_number_(-1), 18 rpo_number_(-1),
19 deferred_(false), 19 deferred_(false),
20 dominator_depth_(-1), 20 dominator_depth_(-1),
21 dominator_(NULL), 21 dominator_(nullptr),
22 rpo_next_(NULL), 22 rpo_next_(nullptr),
23 loop_header_(NULL), 23 loop_header_(nullptr),
24 loop_end_(NULL), 24 loop_end_(nullptr),
25 loop_depth_(0), 25 loop_depth_(0),
26 control_(kNone), 26 control_(kNone),
27 control_input_(NULL), 27 control_input_(nullptr),
28 nodes_(zone), 28 nodes_(zone),
29 successors_(zone), 29 successors_(zone),
30 predecessors_(zone), 30 predecessors_(zone),
31 id_(id) {} 31 id_(id) {}
32 32
33 33
34 bool BasicBlock::LoopContains(BasicBlock* block) const { 34 bool BasicBlock::LoopContains(BasicBlock* block) const {
35 // RPO numbers must be initialized. 35 // RPO numbers must be initialized.
36 DCHECK(rpo_number_ >= 0); 36 DCHECK(rpo_number_ >= 0);
37 DCHECK(block->rpo_number_ >= 0); 37 DCHECK(block->rpo_number_ >= 0);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 76
77 void BasicBlock::set_loop_end(BasicBlock* loop_end) { loop_end_ = loop_end; } 77 void BasicBlock::set_loop_end(BasicBlock* loop_end) { loop_end_ = loop_end; }
78 78
79 79
80 void BasicBlock::set_loop_header(BasicBlock* loop_header) { 80 void BasicBlock::set_loop_header(BasicBlock* loop_header) {
81 loop_header_ = loop_header; 81 loop_header_ = loop_header;
82 } 82 }
83 83
84 84
85 // static
86 BasicBlock* BasicBlock::GetCommonDominator(BasicBlock* b1, BasicBlock* b2) {
87 while (b1 != b2) {
88 if (b1->dominator_depth() < b2->dominator_depth()) {
89 b2 = b2->dominator();
90 } else {
91 b1 = b1->dominator();
92 }
93 }
94 return b1;
95 }
96
97
85 std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c) { 98 std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c) {
86 switch (c) { 99 switch (c) {
87 case BasicBlock::kNone: 100 case BasicBlock::kNone:
88 return os << "none"; 101 return os << "none";
89 case BasicBlock::kGoto: 102 case BasicBlock::kGoto:
90 return os << "goto"; 103 return os << "goto";
91 case BasicBlock::kBranch: 104 case BasicBlock::kBranch:
92 return os << "branch"; 105 return os << "branch";
93 case BasicBlock::kReturn: 106 case BasicBlock::kReturn:
94 return os << "return"; 107 return os << "return";
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 316 }
304 os << "\n"; 317 os << "\n";
305 } 318 }
306 } 319 }
307 return os; 320 return os;
308 } 321 }
309 322
310 } // namespace compiler 323 } // namespace compiler
311 } // namespace internal 324 } // namespace internal
312 } // namespace v8 325 } // namespace v8
OLDNEW
« 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