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

Unified Diff: src/compiler/verifier.cc

Issue 851263002: [turbofan] Initial attempt to cleanup Node and related classes. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/scheduler.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/verifier.cc
diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc
index 116989d4aa1574f9ab21fa784e54108aecea857c..aa5c9a439595cee4b60d57e74eac4af517c289e3 100644
--- a/src/compiler/verifier.cc
+++ b/src/compiler/verifier.cc
@@ -4,6 +4,7 @@
#include "src/compiler/verifier.h"
+#include <algorithm>
#include <deque>
#include <queue>
#include <sstream>
@@ -28,20 +29,14 @@ namespace compiler {
static bool IsDefUseChainLinkPresent(Node* def, Node* use) {
- Node::Uses uses = def->uses();
- for (Node::Uses::iterator it = uses.begin(); it != uses.end(); ++it) {
- if (*it == use) return true;
- }
- return false;
+ auto const uses = def->uses();
+ return std::find(uses.begin(), uses.end(), use) != uses.end();
}
static bool IsUseDefChainLinkPresent(Node* def, Node* use) {
- Node::Inputs inputs = use->inputs();
- for (Node::Inputs::iterator it = inputs.begin(); it != inputs.end(); ++it) {
- if (*it == def) return true;
- }
- return false;
+ auto const inputs = use->inputs();
+ return std::find(inputs.begin(), inputs.end(), def) != inputs.end();
}
@@ -205,13 +200,12 @@ void Verifier::Visitor::Pre(Node* node) {
UNREACHABLE();
case IrOpcode::kBranch: {
// Branch uses are IfTrue and IfFalse.
- Node::Uses uses = node->uses();
int count_true = 0, count_false = 0;
- for (Node::Uses::iterator it = uses.begin(); it != uses.end(); ++it) {
- CHECK((*it)->opcode() == IrOpcode::kIfTrue ||
- (*it)->opcode() == IrOpcode::kIfFalse);
- if ((*it)->opcode() == IrOpcode::kIfTrue) ++count_true;
- if ((*it)->opcode() == IrOpcode::kIfFalse) ++count_false;
+ for (auto use : node->uses()) {
+ CHECK(use->opcode() == IrOpcode::kIfTrue ||
+ use->opcode() == IrOpcode::kIfFalse);
+ if (use->opcode() == IrOpcode::kIfTrue) ++count_true;
+ if (use->opcode() == IrOpcode::kIfFalse) ++count_false;
}
CHECK(count_true == 1 && count_false == 1);
// Type is empty.
@@ -314,7 +308,7 @@ void Verifier::Visitor::Pre(Node* node) {
break;
case IrOpcode::kProjection: {
// Projection has an input that produces enough values.
- int index = static_cast<int>(OpParameter<size_t>(node->op()));
+ int index = static_cast<int>(ProjectionIndexOf(node->op()));
Node* input = NodeProperties::GetValueInput(node, 0);
CHECK_GT(input->op()->ValueOutputCount(), index);
// Type can be anything.
« no previous file with comments | « src/compiler/scheduler.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698