Chromium Code Reviews| 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_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 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 template <class Visitor> | 61 template <class Visitor> |
| 62 void VisitNodeUsesFrom(Node* node, Visitor* visitor); | 62 void VisitNodeUsesFrom(Node* node, Visitor* visitor); |
| 63 | 63 |
| 64 template <class Visitor> | 64 template <class Visitor> |
| 65 void VisitNodeUsesFromStart(Visitor* visitor); | 65 void VisitNodeUsesFromStart(Visitor* visitor); |
| 66 | 66 |
| 67 template <class Visitor> | 67 template <class Visitor> |
| 68 void VisitNodeInputsFromEnd(Visitor* visitor); | 68 void VisitNodeInputsFromEnd(Visitor* visitor); |
| 69 | 69 |
| 70 void Decorate(Node* node); | |
| 71 | |
| 70 void AddDecorator(GraphDecorator* decorator) { | 72 void AddDecorator(GraphDecorator* decorator) { |
| 71 decorators_.push_back(decorator); | 73 decorators_.push_back(decorator); |
| 72 } | 74 } |
| 73 | 75 |
| 74 void RemoveDecorator(GraphDecorator* decorator) { | 76 void RemoveDecorator(GraphDecorator* decorator) { |
| 75 DecoratorVector::iterator it = | 77 DecoratorVector::iterator it = |
| 76 std::find(decorators_.begin(), decorators_.end(), decorator); | 78 std::find(decorators_.begin(), decorators_.end(), decorator); |
| 77 DCHECK(it != decorators_.end()); | 79 DCHECK(it != decorators_.end()); |
| 78 decorators_.erase(it, it + 1); | 80 decorators_.erase(it, it + 1); |
| 79 } | 81 } |
| 80 | 82 |
| 83 bool is_typed() const { return is_typed_; } | |
|
titzer
2014/08/28 13:12:31
Gah, we went through this with the source position
rossberg
2014/08/28 15:35:50
Hm, well, the graph _is_ fundamentally stateful. T
titzer
2014/10/01 08:30:24
Just because nodes and edges can be mutated doesn'
| |
| 84 void MarkTyped() { is_typed_ = true; } | |
| 85 | |
| 81 private: | 86 private: |
| 82 typedef std::vector<GraphDecorator*, zone_allocator<GraphDecorator*> > | 87 typedef std::vector<GraphDecorator*, zone_allocator<GraphDecorator*> > |
| 83 DecoratorVector; | 88 DecoratorVector; |
| 84 DecoratorVector decorators_; | 89 DecoratorVector decorators_; |
| 90 bool is_typed_; | |
| 85 }; | 91 }; |
| 86 | 92 |
| 87 | 93 |
| 88 class GraphDecorator : public ZoneObject { | 94 class GraphDecorator : public ZoneObject { |
| 89 public: | 95 public: |
| 90 virtual ~GraphDecorator() {} | 96 virtual ~GraphDecorator() {} |
| 91 virtual void Decorate(Node* node) = 0; | 97 virtual void Decorate(Node* node) = 0; |
| 92 }; | 98 }; |
| 93 } | 99 } |
| 94 } | 100 } |
| 95 } // namespace v8::internal::compiler | 101 } // namespace v8::internal::compiler |
| 96 | 102 |
| 97 #endif // V8_COMPILER_GRAPH_H_ | 103 #endif // V8_COMPILER_GRAPH_H_ |
| OLD | NEW |