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

Unified Diff: src/compiler/schedule.cc

Issue 864293002: [turbofan] Cleanup Schedule and related classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address auto comments. 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 30bfbc8ecfecc089380d9db4114c0139ef3737b2..0622386400c66af3994fddc850be0db93ff572f3 100644
--- a/src/compiler/schedule.cc
+++ b/src/compiler/schedule.cc
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "src/compiler/schedule.h"
+
#include "src/compiler/node.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/node-properties-inl.h"
-#include "src/compiler/schedule.h"
#include "src/ostreams.h"
namespace v8 {
@@ -235,13 +236,10 @@ void Schedule::AddSuccessor(BasicBlock* block, BasicBlock* succ) {
void Schedule::MoveSuccessors(BasicBlock* from, BasicBlock* to) {
- for (BasicBlock::Predecessors::iterator i = from->successors_begin();
- i != from->successors_end(); ++i) {
- BasicBlock* succ = *i;
- to->AddSuccessor(succ);
- for (BasicBlock::Predecessors::iterator j = succ->predecessors_begin();
- j != succ->predecessors_end(); ++j) {
- if (*j == from) *j = to;
+ for (BasicBlock* const successor : from->successors()) {
+ to->AddSuccessor(successor);
+ for (BasicBlock*& predecessor : successor->predecessors()) {
+ if (predecessor == from) predecessor = to;
}
}
from->ClearSuccessors();
@@ -264,24 +262,18 @@ void Schedule::SetBlockForNode(BasicBlock* block, Node* node) {
std::ostream& operator<<(std::ostream& os, const Schedule& s) {
- // TODO(svenpanne) Const-correct the RPO stuff/iterators.
- BasicBlockVector* rpo = const_cast<Schedule*>(&s)->rpo_order();
- for (BasicBlockVectorIter i = rpo->begin(); i != rpo->end(); ++i) {
- BasicBlock* block = *i;
+ for (BasicBlock* block : *s.rpo_order()) {
os << "--- BLOCK B" << block->id();
if (block->deferred()) os << " (deferred)";
if (block->PredecessorCount() != 0) os << " <- ";
bool comma = false;
- for (BasicBlock::Predecessors::iterator j = block->predecessors_begin();
- j != block->predecessors_end(); ++j) {
+ for (BasicBlock const* predecessor : block->predecessors()) {
if (comma) os << ", ";
comma = true;
- os << "B" << (*j)->id();
+ os << "B" << predecessor->id();
}
os << " ---\n";
- for (BasicBlock::const_iterator j = block->begin(); j != block->end();
- ++j) {
- Node* node = *j;
+ for (Node* node : *block) {
os << " " << *node;
if (NodeProperties::IsTyped(node)) {
Bounds bounds = NodeProperties::GetBounds(node);
@@ -304,11 +296,10 @@ std::ostream& operator<<(std::ostream& os, const Schedule& s) {
}
os << " -> ";
comma = false;
- for (BasicBlock::Successors::iterator j = block->successors_begin();
- j != block->successors_end(); ++j) {
+ for (BasicBlock const* successor : block->successors()) {
if (comma) os << ", ";
comma = true;
- os << "B" << (*j)->id();
+ os << "B" << successor->id();
}
os << "\n";
}
« 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