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

Unified Diff: src/compiler/value-numbering-reducer.cc

Issue 2585713002: [turbofan] Use Node input iterators where possible (Closed)
Patch Set: Use == instead of DCHECK_EQ because of missing operator<< for iterators Created 4 years 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/node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/value-numbering-reducer.cc
diff --git a/src/compiler/value-numbering-reducer.cc b/src/compiler/value-numbering-reducer.cc
index 30473f2798ba96ed160e47ef4e4ae4e1bf3d9bf9..38e1f0c84fb6d1ea3b5341ba1025bcda1285798b 100644
--- a/src/compiler/value-numbering-reducer.cc
+++ b/src/compiler/value-numbering-reducer.cc
@@ -18,8 +18,8 @@ namespace {
size_t HashCode(Node* node) {
size_t h = base::hash_combine(node->op()->HashCode(), node->InputCount());
- for (int j = 0; j < node->InputCount(); ++j) {
- h = base::hash_combine(h, node->InputAt(j)->id());
+ for (Node* input : node->inputs()) {
+ h = base::hash_combine(h, input->id());
}
return h;
}
@@ -32,10 +32,17 @@ bool Equals(Node* a, Node* b) {
DCHECK_NOT_NULL(b->op());
if (!a->op()->Equals(b->op())) return false;
if (a->InputCount() != b->InputCount()) return false;
- for (int j = 0; j < a->InputCount(); ++j) {
- DCHECK_NOT_NULL(a->InputAt(j));
- DCHECK_NOT_NULL(b->InputAt(j));
- if (a->InputAt(j)->id() != b->InputAt(j)->id()) return false;
+ Node::Inputs aInputs = a->inputs();
+ Node::Inputs bInputs = b->inputs();
+
+ auto aIt = aInputs.begin();
+ auto bIt = bInputs.begin();
+ auto aEnd = aInputs.end();
+
+ for (; aIt != aEnd; ++aIt, ++bIt) {
+ DCHECK_NOT_NULL(*aIt);
+ DCHECK_NOT_NULL(*bIt);
+ if ((*aIt)->id() != (*bIt)->id()) return false;
}
return true;
}
« no previous file with comments | « src/compiler/node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698