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

Side by Side Diff: src/compiler/graph.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/generic-node-inl.h ('k') | src/compiler/graph.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef V8_COMPILER_GRAPH_H_
6 #define V8_COMPILER_GRAPH_H_
7
8 #include <map>
9 #include <set>
10
11 #include "src/compiler/generic-algorithm.h"
12 #include "src/compiler/node.h"
13 #include "src/compiler/node-aux-data.h"
14 #include "src/compiler/source-position.h"
15
16 namespace v8 {
17 namespace internal {
18 namespace compiler {
19
20 class GraphDecorator;
21
22
23 class Graph : public GenericGraph<Node> {
24 public:
25 explicit Graph(Zone* zone);
26
27 // Base implementation used by all factory methods.
28 Node* NewNode(Operator* op, int input_count, Node** inputs);
29
30 // Factories for nodes with static input counts.
31 Node* NewNode(Operator* op) {
32 return NewNode(op, 0, static_cast<Node**>(NULL));
33 }
34 Node* NewNode(Operator* op, Node* n1) { return NewNode(op, 1, &n1); }
35 Node* NewNode(Operator* op, Node* n1, Node* n2) {
36 Node* nodes[] = {n1, n2};
37 return NewNode(op, ARRAY_SIZE(nodes), nodes);
38 }
39 Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3) {
40 Node* nodes[] = {n1, n2, n3};
41 return NewNode(op, ARRAY_SIZE(nodes), nodes);
42 }
43 Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
44 Node* nodes[] = {n1, n2, n3, n4};
45 return NewNode(op, ARRAY_SIZE(nodes), nodes);
46 }
47 Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
48 Node* n5) {
49 Node* nodes[] = {n1, n2, n3, n4, n5};
50 return NewNode(op, ARRAY_SIZE(nodes), nodes);
51 }
52 Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5,
53 Node* n6) {
54 Node* nodes[] = {n1, n2, n3, n4, n5, n6};
55 return NewNode(op, ARRAY_SIZE(nodes), nodes);
56 }
57
58 void ChangeOperator(Node* node, Operator* op);
59 void DeleteNode(Node* node);
60
61 template <class Visitor>
62 void VisitNodeUsesFrom(Node* node, Visitor* visitor);
63
64 template <class Visitor>
65 void VisitNodeUsesFromStart(Visitor* visitor);
66
67 template <class Visitor>
68 void VisitNodeInputsFromEnd(Visitor* visitor);
69
70 void AddDecorator(GraphDecorator* decorator) {
71 decorators_.push_back(decorator);
72 }
73
74 void RemoveDecorator(GraphDecorator* decorator) {
75 DecoratorVector::iterator it =
76 std::find(decorators_.begin(), decorators_.end(), decorator);
77 ASSERT(it != decorators_.end());
78 decorators_.erase(it, it + 1);
79 }
80
81 private:
82 typedef std::vector<GraphDecorator*, zone_allocator<GraphDecorator*> >
83 DecoratorVector;
84 DecoratorVector decorators_;
85 };
86
87
88 class GraphDecorator : public ZoneObject {
89 public:
90 virtual ~GraphDecorator() {}
91 virtual void Decorate(Node* node) = 0;
92 };
93 }
94 }
95 } // namespace v8::internal::compiler
96
97 #endif // V8_COMPILER_GRAPH_H_
OLDNEW
« no previous file with comments | « src/compiler/generic-node-inl.h ('k') | src/compiler/graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698