| 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_GENERIC_NODE_H_ | 5 #ifndef V8_COMPILER_GENERIC_NODE_H_ |
| 6 #define V8_COMPILER_GENERIC_NODE_H_ | 6 #define V8_COMPILER_GENERIC_NODE_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 private: | 85 private: |
| 86 GenericNode* node_; | 86 GenericNode* node_; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 Uses uses() { return Uses(this); } | 89 Uses uses() { return Uses(this); } |
| 90 | 90 |
| 91 class Edge; | 91 class Edge; |
| 92 | 92 |
| 93 bool OwnedBy(GenericNode* owner) const; | 93 bool OwnedBy(GenericNode* owner) const; |
| 94 | 94 |
| 95 static S* New(GenericGraphBase* graph, int input_count, S** inputs); | 95 static S* New(GenericGraphBase* graph, int input_count, S** inputs, |
| 96 bool has_extensible_inputs); |
| 96 | 97 |
| 97 protected: | 98 protected: |
| 98 friend class GenericGraphBase; | 99 friend class GenericGraphBase; |
| 99 | 100 |
| 100 class Use : public ZoneObject { | 101 class Use : public ZoneObject { |
| 101 public: | 102 public: |
| 102 GenericNode* from; | 103 GenericNode* from; |
| 103 Use* next; | 104 Use* next; |
| 104 Use* prev; | 105 Use* prev; |
| 105 int input_index; | 106 int input_index; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 121 } else { | 122 } else { |
| 122 return inputs_.static_ + index; | 123 return inputs_.static_ + index; |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 | 126 |
| 126 inline void AppendUse(Use* use); | 127 inline void AppendUse(Use* use); |
| 127 inline void RemoveUse(Use* use); | 128 inline void RemoveUse(Use* use); |
| 128 | 129 |
| 129 void* operator new(size_t, void* location) { return location; } | 130 void* operator new(size_t, void* location) { return location; } |
| 130 | 131 |
| 131 GenericNode(GenericGraphBase* graph, int input_count); | 132 GenericNode(GenericGraphBase* graph, int input_count, |
| 133 int reserved_input_count); |
| 132 | 134 |
| 133 private: | 135 private: |
| 134 void AssignUniqueID(GenericGraphBase* graph); | 136 void AssignUniqueID(GenericGraphBase* graph); |
| 135 | 137 |
| 136 typedef ZoneDeque<Input> InputDeque; | 138 typedef ZoneDeque<Input> InputDeque; |
| 137 | 139 |
| 140 static const int kReservedInputCountBits = 2; |
| 141 static const int kMaxReservedInputs = (1 << kReservedInputCountBits) - 1; |
| 142 static const int kDefaultReservedInputs = kMaxReservedInputs; |
| 143 |
| 138 NodeId id_; | 144 NodeId id_; |
| 139 int input_count_ : 31; | 145 int input_count_ : 29; |
| 146 unsigned int reserve_input_count_ : kReservedInputCountBits; |
| 140 bool has_appendable_inputs_ : 1; | 147 bool has_appendable_inputs_ : 1; |
| 141 union { | 148 union { |
| 142 // When a node is initially allocated, it uses a static buffer to hold its | 149 // When a node is initially allocated, it uses a static buffer to hold its |
| 143 // inputs under the assumption that the number of outputs will not increase. | 150 // inputs under the assumption that the number of outputs will not increase. |
| 144 // When the first input is appended, the static buffer is converted into a | 151 // When the first input is appended, the static buffer is converted into a |
| 145 // deque to allow for space-efficient growing. | 152 // deque to allow for space-efficient growing. |
| 146 Input* static_; | 153 Input* static_; |
| 147 InputDeque* appendable_; | 154 InputDeque* appendable_; |
| 148 } inputs_; | 155 } inputs_; |
| 149 int use_count_; | 156 int use_count_; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 270 } |
| 264 | 271 |
| 265 typename GenericNode<B, S>::Use* current_; | 272 typename GenericNode<B, S>::Use* current_; |
| 266 int index_; | 273 int index_; |
| 267 }; | 274 }; |
| 268 } | 275 } |
| 269 } | 276 } |
| 270 } // namespace v8::internal::compiler | 277 } // namespace v8::internal::compiler |
| 271 | 278 |
| 272 #endif // V8_COMPILER_GENERIC_NODE_H_ | 279 #endif // V8_COMPILER_GENERIC_NODE_H_ |
| OLD | NEW |