| OLD | NEW |
| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 314 |
| 315 | 315 |
| 316 void Schedule::SetBlockForNode(BasicBlock* block, Node* node) { | 316 void Schedule::SetBlockForNode(BasicBlock* block, Node* node) { |
| 317 int length = static_cast<int>(nodeid_to_block_.size()); | 317 int length = static_cast<int>(nodeid_to_block_.size()); |
| 318 if (node->id() >= length) { | 318 if (node->id() >= length) { |
| 319 nodeid_to_block_.resize(node->id() + 1); | 319 nodeid_to_block_.resize(node->id() + 1); |
| 320 } | 320 } |
| 321 nodeid_to_block_[node->id()] = block; | 321 nodeid_to_block_[node->id()] = block; |
| 322 } | 322 } |
| 323 | 323 |
| 324 | |
| 325 std::ostream& operator<<(std::ostream& os, const Schedule& s) { | |
| 326 for (BasicBlock* block : *s.rpo_order()) { | |
| 327 os << "--- BLOCK B" << block->rpo_number(); | |
| 328 if (block->deferred()) os << " (deferred)"; | |
| 329 if (block->PredecessorCount() != 0) os << " <- "; | |
| 330 bool comma = false; | |
| 331 for (BasicBlock const* predecessor : block->predecessors()) { | |
| 332 if (comma) os << ", "; | |
| 333 comma = true; | |
| 334 os << "B" << predecessor->rpo_number(); | |
| 335 } | |
| 336 os << " ---\n"; | |
| 337 for (Node* node : *block) { | |
| 338 os << " " << *node; | |
| 339 if (NodeProperties::IsTyped(node)) { | |
| 340 Bounds bounds = NodeProperties::GetBounds(node); | |
| 341 os << " : "; | |
| 342 bounds.lower->PrintTo(os); | |
| 343 if (!bounds.upper->Is(bounds.lower)) { | |
| 344 os << ".."; | |
| 345 bounds.upper->PrintTo(os); | |
| 346 } | |
| 347 } | |
| 348 os << "\n"; | |
| 349 } | |
| 350 BasicBlock::Control control = block->control(); | |
| 351 if (control != BasicBlock::kNone) { | |
| 352 os << " "; | |
| 353 if (block->control_input() != NULL) { | |
| 354 os << *block->control_input(); | |
| 355 } else { | |
| 356 os << "Goto"; | |
| 357 } | |
| 358 os << " -> "; | |
| 359 comma = false; | |
| 360 for (BasicBlock const* successor : block->successors()) { | |
| 361 if (comma) os << ", "; | |
| 362 comma = true; | |
| 363 os << "B" << successor->rpo_number(); | |
| 364 } | |
| 365 os << "\n"; | |
| 366 } | |
| 367 } | |
| 368 return os; | |
| 369 } | |
| 370 | |
| 371 } // namespace compiler | 324 } // namespace compiler |
| 372 } // namespace internal | 325 } // namespace internal |
| 373 } // namespace v8 | 326 } // namespace v8 |
| OLD | NEW |