| 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/types-inl.h" | 10 #include "src/types-inl.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 Use* use; | 161 Use* use; |
| 162 | 162 |
| 163 void Update(Node* new_to); | 163 void Update(Node* new_to); |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 inline Node(NodeId id, const Operator* op, int input_count, | 166 inline Node(NodeId id, const Operator* op, int input_count, |
| 167 int reserve_input_count); | 167 int reserve_input_count); |
| 168 | 168 |
| 169 inline void EnsureAppendableInputs(Zone* zone); | 169 inline void EnsureAppendableInputs(Zone* zone); |
| 170 | 170 |
| 171 Input* GetInputRecordPtr(int index) const { | 171 Input* GetInputRecordPtr(int index) { |
| 172 if (has_appendable_inputs()) { | 172 return has_appendable_inputs() ? &((*inputs_.appendable_)[index]) |
| 173 return &((*inputs_.appendable_)[index]); | 173 : &inputs_.static_[index]; |
| 174 } else { | 174 } |
| 175 return &inputs_.static_[index]; | 175 const Input* GetInputRecordPtr(int index) const { |
| 176 } | 176 return has_appendable_inputs() ? &((*inputs_.appendable_)[index]) |
| 177 : &inputs_.static_[index]; |
| 177 } | 178 } |
| 178 | 179 |
| 179 inline void AppendUse(Use* const use); | 180 inline void AppendUse(Use* const use); |
| 180 inline void RemoveUse(Use* const use); | 181 inline void RemoveUse(Use* const use); |
| 181 | 182 |
| 182 void* operator new(size_t, void* location) { return location; } | 183 void* operator new(size_t, void* location) { return location; } |
| 183 | 184 |
| 184 typedef ZoneDeque<Input> InputDeque; | 185 typedef ZoneDeque<Input> InputDeque; |
| 185 | 186 |
| 186 // Only NodeProperties should manipulate the bounds. | 187 // Only NodeProperties should manipulate the bounds. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 217 typedef BitField<unsigned, 0, 29> InputCountField; | 218 typedef BitField<unsigned, 0, 29> InputCountField; |
| 218 typedef BitField<unsigned, 29, 2> ReservedInputCountField; | 219 typedef BitField<unsigned, 29, 2> ReservedInputCountField; |
| 219 typedef BitField<unsigned, 31, 1> HasAppendableInputsField; | 220 typedef BitField<unsigned, 31, 1> HasAppendableInputsField; |
| 220 static const int kDefaultReservedInputs = ReservedInputCountField::kMax; | 221 static const int kDefaultReservedInputs = ReservedInputCountField::kMax; |
| 221 | 222 |
| 222 const Operator* op_; | 223 const Operator* op_; |
| 223 Bounds bounds_; | 224 Bounds bounds_; |
| 224 Mark mark_; | 225 Mark mark_; |
| 225 NodeId const id_; | 226 NodeId const id_; |
| 226 unsigned bit_field_; | 227 unsigned bit_field_; |
| 228 Use* first_use_; |
| 229 Use* last_use_; |
| 227 union { | 230 union { |
| 228 // When a node is initially allocated, it uses a static buffer to hold its | 231 // When a node is initially allocated, it uses a static buffer to hold its |
| 229 // inputs under the assumption that the number of outputs will not increase. | 232 // inputs under the assumption that the number of outputs will not increase. |
| 230 // When the first input is appended, the static buffer is converted into a | 233 // When the first input is appended, the static buffer is converted into a |
| 231 // deque to allow for space-efficient growing. | 234 // deque to allow for space-efficient growing. |
| 232 Input* static_; | 235 Input static_[1]; |
| 233 InputDeque* appendable_; | 236 InputDeque* appendable_; |
| 234 } inputs_; | 237 } inputs_; |
| 235 Use* first_use_; | |
| 236 Use* last_use_; | |
| 237 | 238 |
| 238 friend class Edge; | 239 friend class Edge; |
| 239 friend class NodeMarkerBase; | 240 friend class NodeMarkerBase; |
| 240 friend class NodeProperties; | 241 friend class NodeProperties; |
| 241 | 242 |
| 242 DISALLOW_COPY_AND_ASSIGN(Node); | 243 DISALLOW_COPY_AND_ASSIGN(Node); |
| 243 }; | 244 }; |
| 244 | 245 |
| 245 | 246 |
| 246 std::ostream& operator<<(std::ostream& os, const Node& n); | 247 std::ostream& operator<<(std::ostream& os, const Node& n); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 477 |
| 477 void Node::ReplaceInput(int index, Node* new_to) { | 478 void Node::ReplaceInput(int index, Node* new_to) { |
| 478 GetInputRecordPtr(index)->Update(new_to); | 479 GetInputRecordPtr(index)->Update(new_to); |
| 479 } | 480 } |
| 480 | 481 |
| 481 } // namespace compiler | 482 } // namespace compiler |
| 482 } // namespace internal | 483 } // namespace internal |
| 483 } // namespace v8 | 484 } // namespace v8 |
| 484 | 485 |
| 485 #endif // V8_COMPILER_NODE_H_ | 486 #endif // V8_COMPILER_NODE_H_ |
| OLD | NEW |