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

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

Issue 951553005: [turbofan] remove dependence of InstructionBlock on BasicBlock (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/verifier.cc » ('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/ostreams.h" 9 #include "src/ostreams.h"
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 UNREACHABLE(); 114 UNREACHABLE();
115 return os; 115 return os;
116 } 116 }
117 117
118 118
119 std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id) { 119 std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id) {
120 return os << id.ToSize(); 120 return os << id.ToSize();
121 } 121 }
122 122
123 123
124 std::ostream& operator<<(std::ostream& os, const BasicBlock::RpoNumber& rpo) {
125 return os << rpo.ToSize();
126 }
127
128
129 Schedule::Schedule(Zone* zone, size_t node_count_hint) 124 Schedule::Schedule(Zone* zone, size_t node_count_hint)
130 : zone_(zone), 125 : zone_(zone),
131 all_blocks_(zone), 126 all_blocks_(zone),
132 nodeid_to_block_(zone), 127 nodeid_to_block_(zone),
133 rpo_order_(zone), 128 rpo_order_(zone),
134 start_(NewBasicBlock()), 129 start_(NewBasicBlock()),
135 end_(NewBasicBlock()) { 130 end_(NewBasicBlock()) {
136 nodeid_to_block_.reserve(node_count_hint); 131 nodeid_to_block_.reserve(node_count_hint);
137 } 132 }
138 133
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 int length = static_cast<int>(nodeid_to_block_.size()); 307 int length = static_cast<int>(nodeid_to_block_.size());
313 if (node->id() >= length) { 308 if (node->id() >= length) {
314 nodeid_to_block_.resize(node->id() + 1); 309 nodeid_to_block_.resize(node->id() + 1);
315 } 310 }
316 nodeid_to_block_[node->id()] = block; 311 nodeid_to_block_[node->id()] = block;
317 } 312 }
318 313
319 314
320 std::ostream& operator<<(std::ostream& os, const Schedule& s) { 315 std::ostream& operator<<(std::ostream& os, const Schedule& s) {
321 for (BasicBlock* block : *s.rpo_order()) { 316 for (BasicBlock* block : *s.rpo_order()) {
322 os << "--- BLOCK B" << block->id(); 317 os << "--- BLOCK B" << block->rpo_number();
323 if (block->deferred()) os << " (deferred)"; 318 if (block->deferred()) os << " (deferred)";
324 if (block->PredecessorCount() != 0) os << " <- "; 319 if (block->PredecessorCount() != 0) os << " <- ";
325 bool comma = false; 320 bool comma = false;
326 for (BasicBlock const* predecessor : block->predecessors()) { 321 for (BasicBlock const* predecessor : block->predecessors()) {
327 if (comma) os << ", "; 322 if (comma) os << ", ";
328 comma = true; 323 comma = true;
329 os << "B" << predecessor->id(); 324 os << "B" << predecessor->rpo_number();
330 } 325 }
331 os << " ---\n"; 326 os << " ---\n";
332 for (Node* node : *block) { 327 for (Node* node : *block) {
333 os << " " << *node; 328 os << " " << *node;
334 if (NodeProperties::IsTyped(node)) { 329 if (NodeProperties::IsTyped(node)) {
335 Bounds bounds = NodeProperties::GetBounds(node); 330 Bounds bounds = NodeProperties::GetBounds(node);
336 os << " : "; 331 os << " : ";
337 bounds.lower->PrintTo(os); 332 bounds.lower->PrintTo(os);
338 if (!bounds.upper->Is(bounds.lower)) { 333 if (!bounds.upper->Is(bounds.lower)) {
339 os << ".."; 334 os << "..";
340 bounds.upper->PrintTo(os); 335 bounds.upper->PrintTo(os);
341 } 336 }
342 } 337 }
343 os << "\n"; 338 os << "\n";
344 } 339 }
345 BasicBlock::Control control = block->control(); 340 BasicBlock::Control control = block->control();
346 if (control != BasicBlock::kNone) { 341 if (control != BasicBlock::kNone) {
347 os << " "; 342 os << " ";
348 if (block->control_input() != NULL) { 343 if (block->control_input() != NULL) {
349 os << *block->control_input(); 344 os << *block->control_input();
350 } else { 345 } else {
351 os << "Goto"; 346 os << "Goto";
352 } 347 }
353 os << " -> "; 348 os << " -> ";
354 comma = false; 349 comma = false;
355 for (BasicBlock const* successor : block->successors()) { 350 for (BasicBlock const* successor : block->successors()) {
356 if (comma) os << ", "; 351 if (comma) os << ", ";
357 comma = true; 352 comma = true;
358 os << "B" << successor->id(); 353 os << "B" << successor->rpo_number();
359 } 354 }
360 os << "\n"; 355 os << "\n";
361 } 356 }
362 } 357 }
363 return os; 358 return os;
364 } 359 }
365 360
366 } // namespace compiler 361 } // namespace compiler
367 } // namespace internal 362 } // namespace internal
368 } // namespace v8 363 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698