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
3 // found in the LICENSE file.
5 #ifndef V8_COMPILER_GENERIC_ALGORITHM_INL_H_
6 #define V8_COMPILER_GENERIC_ALGORITHM_INL_H_
10 #include "src/compiler/generic-algorithm.h"
11 #include "src/compiler/generic-graph.h"
12 #include "src/compiler/generic-node.h"
13 #include "src/compiler/generic-node-inl.h"
20 class NodeInputIterationTraits {
23 typedef typename N::Inputs::iterator Iterator;
25 static Iterator begin(Node* node) { return node->inputs().begin(); }
26 static Iterator end(Node* node) { return node->inputs().end(); }
27 static int max_id(GenericGraphBase* graph) { return graph->NodeCount(); }
28 static Node* to(Iterator iterator) { return *iterator; }
29 static Node* from(Iterator iterator) { return iterator.edge().from(); }
33 class NodeUseIterationTraits {
36 typedef typename N::Uses::iterator Iterator;
38 static Iterator begin(Node* node) { return node->uses().begin(); }
39 static Iterator end(Node* node) { return node->uses().end(); }
40 static int max_id(GenericGraphBase* graph) { return graph->NodeCount(); }
41 static Node* to(Iterator iterator) { return *iterator; }
42 static Node* from(Iterator iterator) { return iterator.edge().to(); }
46 } // namespace v8::internal::compiler
48 #endif // V8_COMPILER_GENERIC_ALGORITHM_INL_H_