| 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 |
| 81 private: | 83 private: |
| 82 typedef std::vector<GraphDecorator*, zone_allocator<GraphDecorator*> > | 84 typedef std::vector<GraphDecorator*, zone_allocator<GraphDecorator*> > |
| 83 DecoratorVector; | 85 DecoratorVector; |
| 84 DecoratorVector decorators_; | 86 DecoratorVector decorators_; |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 | 89 |
| 88 class GraphDecorator : public ZoneObject { | 90 class GraphDecorator : public ZoneObject { |
| 89 public: | 91 public: |
| 90 virtual ~GraphDecorator() {} | 92 virtual ~GraphDecorator() {} |
| 91 virtual void Decorate(Node* node) = 0; | 93 virtual void Decorate(Node* node) = 0; |
| 92 }; | 94 }; |
| 93 } | 95 } |
| 94 } | 96 } |
| 95 } // namespace v8::internal::compiler | 97 } // namespace v8::internal::compiler |
| 96 | 98 |
| 97 #endif // V8_COMPILER_GRAPH_H_ | 99 #endif // V8_COMPILER_GRAPH_H_ |
| OLD | NEW |