OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_GENERIC_ALGORITHM_INL_H_ | 5 #ifndef V8_COMPILER_GENERIC_ALGORITHM_INL_H_ |
6 #define V8_COMPILER_GENERIC_ALGORITHM_INL_H_ | 6 #define V8_COMPILER_GENERIC_ALGORITHM_INL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/compiler/generic-algorithm.h" | 10 #include "src/compiler/generic-algorithm.h" |
11 #include "src/compiler/graph.h" | 11 #include "src/compiler/graph.h" |
12 #include "src/compiler/node.h" | 12 #include "src/compiler/node.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 template <class N> | 18 template <class N> |
19 class NodeInputIterationTraits { | 19 class NodeInputIterationTraits { |
20 public: | 20 public: |
21 typedef N Node; | 21 typedef N Node; |
22 typedef typename N::Inputs::iterator Iterator; | 22 typedef typename N::InputEdges::iterator Iterator; |
23 | 23 |
24 static Iterator begin(Node* node) { return node->inputs().begin(); } | 24 static Iterator begin(Node* node) { return node->input_edges().begin(); } |
25 static Iterator end(Node* node) { return node->inputs().end(); } | 25 static Iterator end(Node* node) { return node->input_edges().end(); } |
26 static int max_id(Graph* graph) { return graph->NodeCount(); } | 26 static int max_id(Graph* graph) { return graph->NodeCount(); } |
27 static Node* to(Iterator iterator) { return *iterator; } | 27 static Node* to(Iterator iterator) { return (*iterator).to(); } |
28 static Node* from(Iterator iterator) { return iterator.edge().from(); } | 28 static Node* from(Iterator iterator) { return (*iterator).from(); } |
29 }; | 29 }; |
30 | 30 |
31 } // namespace compiler | 31 } // namespace compiler |
32 } // namespace internal | 32 } // namespace internal |
33 } // namespace v8 | 33 } // namespace v8 |
34 | 34 |
35 #endif // V8_COMPILER_GENERIC_ALGORITHM_INL_H_ | 35 #endif // V8_COMPILER_GENERIC_ALGORITHM_INL_H_ |
OLD | NEW |