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

Unified Diff: src/compiler/generic-node-inl.h

Issue 765983002: Clean up node iteration (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment Created 6 years, 1 month 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
Index: src/compiler/generic-node-inl.h
diff --git a/src/compiler/generic-node-inl.h b/src/compiler/generic-node-inl.h
index afbd1f0ebf2067eb35cb370c16a7b7f5eefe2aa5..13bfa6c24ffa9252146ca90c6bcb90d3155cc14f 100644
--- a/src/compiler/generic-node-inl.h
+++ b/src/compiler/generic-node-inl.h
@@ -49,6 +49,19 @@ GenericNode<B, S>::Inputs::end() {
}
template <class B, class S>
+inline typename GenericNode<B, S>::InputEdges::iterator
+GenericNode<B, S>::InputEdges::begin() {
+ return typename GenericNode<B, S>::InputEdges::iterator(this->node_, 0);
+}
+
+template <class B, class S>
+inline typename GenericNode<B, S>::InputEdges::iterator
+GenericNode<B, S>::InputEdges::end() {
+ return typename GenericNode<B, S>::InputEdges::iterator(
+ this->node_, this->node_->InputCount());
+}
+
+template <class B, class S>
inline typename GenericNode<B, S>::Uses::iterator
GenericNode<B, S>::Uses::begin() {
return typename GenericNode<B, S>::Uses::iterator(this->node_);
@@ -61,6 +74,18 @@ GenericNode<B, S>::Uses::end() {
}
template <class B, class S>
+inline typename GenericNode<B, S>::UseEdges::iterator
+GenericNode<B, S>::UseEdges::begin() {
+ return typename GenericNode<B, S>::UseEdges::iterator(this->node_);
+}
+
+template <class B, class S>
+inline typename GenericNode<B, S>::UseEdges::iterator
+GenericNode<B, S>::UseEdges::end() {
+ return typename GenericNode<B, S>::UseEdges::iterator();
+}
+
+template <class B, class S>
void GenericNode<B, S>::ReplaceUses(GenericNode* replace_to) {
for (Use* use = first_use_; use != NULL; use = use->next) {
use->from->GetInputRecordPtr(use->input_index)->to = replace_to;
@@ -98,9 +123,8 @@ void GenericNode<B, S>::ReplaceUsesIf(UnaryPredicate pred,
template <class B, class S>
void GenericNode<B, S>::RemoveAllInputs() {
- for (typename Inputs::iterator iter(inputs().begin()); iter != inputs().end();
- ++iter) {
- iter.GetInput()->Update(NULL);
+ for (auto edge : input_edges()) {
+ edge.UpdateTo(NULL);
}
}

Powered by Google App Engine
This is Rietveld 408576698