| 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_NODE_H_ | 5 #ifndef V8_COMPILER_NODE_H_ |
| 6 #define V8_COMPILER_NODE_H_ | 6 #define V8_COMPILER_NODE_H_ |
| 7 | 7 |
| 8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
| 9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
| 10 #include "src/compiler/types.h" | 10 #include "src/compiler/types.h" |
| 11 #include "src/globals.h" |
| 11 #include "src/zone/zone-containers.h" | 12 #include "src/zone/zone-containers.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 namespace compiler { | 16 namespace compiler { |
| 16 | 17 |
| 17 // Forward declarations. | 18 // Forward declarations. |
| 18 class Edge; | 19 class Edge; |
| 19 class Graph; | 20 class Graph; |
| 20 | 21 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 | 33 |
| 33 // A Node is the basic primitive of graphs. Nodes are chained together by | 34 // A Node is the basic primitive of graphs. Nodes are chained together by |
| 34 // input/use chains but by default otherwise contain only an identifying number | 35 // input/use chains but by default otherwise contain only an identifying number |
| 35 // which specific applications of graphs and nodes can use to index auxiliary | 36 // which specific applications of graphs and nodes can use to index auxiliary |
| 36 // out-of-line data, especially transient data. | 37 // out-of-line data, especially transient data. |
| 37 // | 38 // |
| 38 // In addition Nodes only contain a mutable Operator that may change during | 39 // In addition Nodes only contain a mutable Operator that may change during |
| 39 // compilation, e.g. during lowering passes. Other information that needs to be | 40 // compilation, e.g. during lowering passes. Other information that needs to be |
| 40 // associated with Nodes during compilation must be stored out-of-line indexed | 41 // associated with Nodes during compilation must be stored out-of-line indexed |
| 41 // by the Node's id. | 42 // by the Node's id. |
| 42 class Node final { | 43 class V8_EXPORT_PRIVATE Node final { |
| 43 public: | 44 public: |
| 44 static Node* New(Zone* zone, NodeId id, const Operator* op, int input_count, | 45 static Node* New(Zone* zone, NodeId id, const Operator* op, int input_count, |
| 45 Node* const* inputs, bool has_extensible_inputs); | 46 Node* const* inputs, bool has_extensible_inputs); |
| 46 static Node* Clone(Zone* zone, NodeId id, const Node* node); | 47 static Node* Clone(Zone* zone, NodeId id, const Node* node); |
| 47 | 48 |
| 48 bool IsDead() const { return InputCount() > 0 && !InputAt(0); } | 49 bool IsDead() const { return InputCount() > 0 && !InputAt(0); } |
| 49 void Kill(); | 50 void Kill(); |
| 50 | 51 |
| 51 const Operator* op() const { return op_; } | 52 const Operator* op() const { return op_; } |
| 52 | 53 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 bool empty() const; | 120 bool empty() const; |
| 120 | 121 |
| 121 explicit InputEdges(Node* node) : node_(node) {} | 122 explicit InputEdges(Node* node) : node_(node) {} |
| 122 | 123 |
| 123 private: | 124 private: |
| 124 Node* node_; | 125 Node* node_; |
| 125 }; | 126 }; |
| 126 | 127 |
| 127 InputEdges input_edges() { return InputEdges(this); } | 128 InputEdges input_edges() { return InputEdges(this); } |
| 128 | 129 |
| 129 class Inputs final { | 130 class V8_EXPORT_PRIVATE Inputs final { |
| 130 public: | 131 public: |
| 131 typedef Node* value_type; | 132 typedef Node* value_type; |
| 132 | 133 |
| 133 class const_iterator; | 134 class const_iterator; |
| 134 inline const_iterator begin() const; | 135 inline const_iterator begin() const; |
| 135 inline const_iterator end() const; | 136 inline const_iterator end() const; |
| 136 | 137 |
| 137 bool empty() const; | 138 bool empty() const; |
| 138 | 139 |
| 139 explicit Inputs(Node* node) : node_(node) {} | 140 explicit Inputs(Node* node) : node_(node) {} |
| (...skipping 15 matching lines...) Expand all Loading... |
| 155 bool empty() const; | 156 bool empty() const; |
| 156 | 157 |
| 157 explicit UseEdges(Node* node) : node_(node) {} | 158 explicit UseEdges(Node* node) : node_(node) {} |
| 158 | 159 |
| 159 private: | 160 private: |
| 160 Node* node_; | 161 Node* node_; |
| 161 }; | 162 }; |
| 162 | 163 |
| 163 UseEdges use_edges() { return UseEdges(this); } | 164 UseEdges use_edges() { return UseEdges(this); } |
| 164 | 165 |
| 165 class Uses final { | 166 class V8_EXPORT_PRIVATE Uses final { |
| 166 public: | 167 public: |
| 167 typedef Node* value_type; | 168 typedef Node* value_type; |
| 168 | 169 |
| 169 class const_iterator; | 170 class const_iterator; |
| 170 inline const_iterator begin() const; | 171 inline const_iterator begin() const; |
| 171 inline const_iterator end() const; | 172 inline const_iterator end() const; |
| 172 | 173 |
| 173 bool empty() const; | 174 bool empty() const; |
| 174 | 175 |
| 175 explicit Uses(Node* node) : node_(node) {} | 176 explicit Uses(Node* node) : node_(node) {} |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 557 } |
| 557 | 558 |
| 558 | 559 |
| 559 Node::Uses::const_iterator Node::Uses::end() const { return const_iterator(); } | 560 Node::Uses::const_iterator Node::Uses::end() const { return const_iterator(); } |
| 560 | 561 |
| 561 } // namespace compiler | 562 } // namespace compiler |
| 562 } // namespace internal | 563 } // namespace internal |
| 563 } // namespace v8 | 564 } // namespace v8 |
| 564 | 565 |
| 565 #endif // V8_COMPILER_NODE_H_ | 566 #endif // V8_COMPILER_NODE_H_ |
| OLD | NEW |