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

Side by Side Diff: src/compiler/schedule.cc

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/simplified-operator.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/node.h" 5 #include "src/compiler/node.h"
6 #include "src/compiler/node-properties.h" 6 #include "src/compiler/node-properties.h"
7 #include "src/compiler/node-properties-inl.h" 7 #include "src/compiler/node-properties-inl.h"
8 #include "src/compiler/schedule.h" 8 #include "src/compiler/schedule.h"
9 #include "src/ostreams.h" 9 #include "src/ostreams.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15
16 BasicBlock::BasicBlock(Zone* zone, Id id) 15 BasicBlock::BasicBlock(Zone* zone, Id id)
17 : rpo_number_(-1), 16 : rpo_number_(-1),
18 dominator_(NULL), 17 dominator_(NULL),
19 loop_header_(NULL), 18 loop_header_(NULL),
20 loop_depth_(0), 19 loop_depth_(0),
21 loop_end_(-1), 20 loop_end_(-1),
22 code_start_(-1), 21 code_start_(-1),
23 code_end_(-1), 22 code_end_(-1),
24 deferred_(false), 23 deferred_(false),
25 control_(kNone), 24 control_(kNone),
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 size_t BasicBlock::PredecessorIndexOf(BasicBlock* predecessor) { 102 size_t BasicBlock::PredecessorIndexOf(BasicBlock* predecessor) {
104 size_t j = 0; 103 size_t j = 0;
105 for (BasicBlock::Predecessors::iterator i = predecessors_.begin(); 104 for (BasicBlock::Predecessors::iterator i = predecessors_.begin();
106 i != predecessors_.end(); ++i, ++j) { 105 i != predecessors_.end(); ++i, ++j) {
107 if (*i == predecessor) break; 106 if (*i == predecessor) break;
108 } 107 }
109 return j; 108 return j;
110 } 109 }
111 110
112 111
113 OStream& operator<<(OStream& os, const BasicBlock::Control& c) { 112 std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c) {
114 switch (c) { 113 switch (c) {
115 case BasicBlock::kNone: 114 case BasicBlock::kNone:
116 return os << "none"; 115 return os << "none";
117 case BasicBlock::kGoto: 116 case BasicBlock::kGoto:
118 return os << "goto"; 117 return os << "goto";
119 case BasicBlock::kBranch: 118 case BasicBlock::kBranch:
120 return os << "branch"; 119 return os << "branch";
121 case BasicBlock::kReturn: 120 case BasicBlock::kReturn:
122 return os << "return"; 121 return os << "return";
123 case BasicBlock::kThrow: 122 case BasicBlock::kThrow:
124 return os << "throw"; 123 return os << "throw";
125 } 124 }
126 UNREACHABLE(); 125 UNREACHABLE();
127 return os; 126 return os;
128 } 127 }
129 128
130 129
131 OStream& operator<<(OStream& os, const BasicBlock::Id& id) { 130 std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id) {
132 return os << id.ToSize(); 131 return os << id.ToSize();
133 } 132 }
134 133
135 134
136 Schedule::Schedule(Zone* zone, size_t node_count_hint) 135 Schedule::Schedule(Zone* zone, size_t node_count_hint)
137 : zone_(zone), 136 : zone_(zone),
138 all_blocks_(zone), 137 all_blocks_(zone),
139 nodeid_to_block_(zone), 138 nodeid_to_block_(zone),
140 rpo_order_(zone), 139 rpo_order_(zone),
141 start_(NewBasicBlock()), 140 start_(NewBasicBlock()),
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 259
261 void Schedule::SetBlockForNode(BasicBlock* block, Node* node) { 260 void Schedule::SetBlockForNode(BasicBlock* block, Node* node) {
262 int length = static_cast<int>(nodeid_to_block_.size()); 261 int length = static_cast<int>(nodeid_to_block_.size());
263 if (node->id() >= length) { 262 if (node->id() >= length) {
264 nodeid_to_block_.resize(node->id() + 1); 263 nodeid_to_block_.resize(node->id() + 1);
265 } 264 }
266 nodeid_to_block_[node->id()] = block; 265 nodeid_to_block_[node->id()] = block;
267 } 266 }
268 267
269 268
270 OStream& operator<<(OStream& os, const Schedule& s) { 269 std::ostream& operator<<(std::ostream& os, const Schedule& s) {
271 // TODO(svenpanne) Const-correct the RPO stuff/iterators. 270 // TODO(svenpanne) Const-correct the RPO stuff/iterators.
272 BasicBlockVector* rpo = const_cast<Schedule*>(&s)->rpo_order(); 271 BasicBlockVector* rpo = const_cast<Schedule*>(&s)->rpo_order();
273 for (BasicBlockVectorIter i = rpo->begin(); i != rpo->end(); ++i) { 272 for (BasicBlockVectorIter i = rpo->begin(); i != rpo->end(); ++i) {
274 BasicBlock* block = *i; 273 BasicBlock* block = *i;
275 os << "--- BLOCK B" << block->id(); 274 os << "--- BLOCK B" << block->id();
276 if (block->PredecessorCount() != 0) os << " <- "; 275 if (block->PredecessorCount() != 0) os << " <- ";
277 bool comma = false; 276 bool comma = false;
278 for (BasicBlock::Predecessors::iterator j = block->predecessors_begin(); 277 for (BasicBlock::Predecessors::iterator j = block->predecessors_begin();
279 j != block->predecessors_end(); ++j) { 278 j != block->predecessors_end(); ++j) {
280 if (comma) os << ", "; 279 if (comma) os << ", ";
(...skipping 30 matching lines...) Expand all
311 j != block->successors_end(); ++j) { 310 j != block->successors_end(); ++j) {
312 if (comma) os << ", "; 311 if (comma) os << ", ";
313 comma = true; 312 comma = true;
314 os << "B" << (*j)->id(); 313 os << "B" << (*j)->id();
315 } 314 }
316 os << "\n"; 315 os << "\n";
317 } 316 }
318 } 317 }
319 return os; 318 return os;
320 } 319 }
320
321 } // namespace compiler 321 } // namespace compiler
322 } // namespace internal 322 } // namespace internal
323 } // namespace v8 323 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698