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

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

Issue 658543002: Better typing and type verification (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 years, 2 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
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_GRAPH_H_ 5 #ifndef V8_COMPILER_GRAPH_H_
6 #define V8_COMPILER_GRAPH_H_ 6 #define V8_COMPILER_GRAPH_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
11 #include "src/compiler/generic-algorithm.h" 11 #include "src/compiler/generic-algorithm.h"
12 #include "src/compiler/node.h" 12 #include "src/compiler/node.h"
13 #include "src/compiler/node-aux-data.h" 13 #include "src/compiler/node-aux-data.h"
14 #include "src/compiler/source-position.h" 14 #include "src/compiler/source-position.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 namespace compiler { 18 namespace compiler {
19 19
20 class GraphDecorator; 20 class GraphDecorator;
21 21
22 22
23 class Graph : public GenericGraph<Node> { 23 class Graph : public GenericGraph<Node> {
24 public: 24 public:
25 explicit Graph(Zone* zone); 25 explicit Graph(Zone* zone);
26 26
27 // Base implementation used by all factory methods. 27 // Base implementation used by all factory methods.
28 Node* NewNode(const Operator* op, int input_count, Node** inputs); 28 Node* NewNode(const Operator* op, int input_count, Node** inputs,
29 bool incomplete = false);
29 30
30 // Factories for nodes with static input counts. 31 // Factories for nodes with static input counts.
31 Node* NewNode(const Operator* op) { 32 Node* NewNode(const Operator* op) {
32 return NewNode(op, 0, static_cast<Node**>(NULL)); 33 return NewNode(op, 0, static_cast<Node**>(NULL));
33 } 34 }
34 Node* NewNode(const Operator* op, Node* n1) { return NewNode(op, 1, &n1); } 35 Node* NewNode(const Operator* op, Node* n1) { return NewNode(op, 1, &n1); }
35 Node* NewNode(const Operator* op, Node* n1, Node* n2) { 36 Node* NewNode(const Operator* op, Node* n1, Node* n2) {
36 Node* nodes[] = {n1, n2}; 37 Node* nodes[] = {n1, n2};
37 return NewNode(op, arraysize(nodes), nodes); 38 return NewNode(op, arraysize(nodes), nodes);
38 } 39 }
(...skipping 18 matching lines...) Expand all
57 58
58 template <class Visitor> 59 template <class Visitor>
59 void VisitNodeUsesFrom(Node* node, Visitor* visitor); 60 void VisitNodeUsesFrom(Node* node, Visitor* visitor);
60 61
61 template <class Visitor> 62 template <class Visitor>
62 void VisitNodeUsesFromStart(Visitor* visitor); 63 void VisitNodeUsesFromStart(Visitor* visitor);
63 64
64 template <class Visitor> 65 template <class Visitor>
65 void VisitNodeInputsFromEnd(Visitor* visitor); 66 void VisitNodeInputsFromEnd(Visitor* visitor);
66 67
68 void Decorate(Node* node);
69
67 void AddDecorator(GraphDecorator* decorator) { 70 void AddDecorator(GraphDecorator* decorator) {
68 decorators_.push_back(decorator); 71 decorators_.push_back(decorator);
69 } 72 }
70 73
71 void RemoveDecorator(GraphDecorator* decorator) { 74 void RemoveDecorator(GraphDecorator* decorator) {
72 ZoneVector<GraphDecorator*>::iterator it = 75 ZoneVector<GraphDecorator*>::iterator it =
73 std::find(decorators_.begin(), decorators_.end(), decorator); 76 std::find(decorators_.begin(), decorators_.end(), decorator);
74 DCHECK(it != decorators_.end()); 77 DCHECK(it != decorators_.end());
75 decorators_.erase(it, it + 1); 78 decorators_.erase(it, it + 1);
76 } 79 }
77 80
78 private: 81 private:
79 ZoneVector<GraphDecorator*> decorators_; 82 ZoneVector<GraphDecorator*> decorators_;
80 }; 83 };
81 84
82 85
83 class GraphDecorator : public ZoneObject { 86 class GraphDecorator : public ZoneObject {
84 public: 87 public:
85 virtual ~GraphDecorator() {} 88 virtual ~GraphDecorator() {}
86 virtual void Decorate(Node* node) = 0; 89 virtual void Decorate(Node* node) = 0;
87 }; 90 };
88 91
89 } // namespace compiler 92 } // namespace compiler
90 } // namespace internal 93 } // namespace internal
91 } // namespace v8 94 } // namespace v8
92 95
93 #endif // V8_COMPILER_GRAPH_H_ 96 #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