| 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 <deque> | |
| 9 | |
| 10 #include "src/v8.h" | 8 #include "src/v8.h" |
| 11 | 9 |
| 12 #include "src/compiler/operator.h" | 10 #include "src/zone-containers.h" |
| 13 #include "src/zone.h" | |
| 14 #include "src/zone-allocator.h" | |
| 15 | 11 |
| 16 namespace v8 { | 12 namespace v8 { |
| 17 namespace internal { | 13 namespace internal { |
| 18 namespace compiler { | 14 namespace compiler { |
| 19 | 15 |
| 20 class Operator; | |
| 21 class GenericGraphBase; | 16 class GenericGraphBase; |
| 22 | 17 |
| 23 typedef int NodeId; | 18 typedef int NodeId; |
| 24 | 19 |
| 25 // A GenericNode<> is the basic primitive of graphs. GenericNode's are | 20 // A GenericNode<> is the basic primitive of graphs. GenericNode's are |
| 26 // chained together by input/use chains but by default otherwise contain only an | 21 // chained together by input/use chains but by default otherwise contain only an |
| 27 // identifying number which specific applications of graphs and nodes can use | 22 // identifying number which specific applications of graphs and nodes can use |
| 28 // to index auxiliary out-of-line data, especially transient data. | 23 // to index auxiliary out-of-line data, especially transient data. |
| 29 // Specializations of the templatized GenericNode<> class must provide a base | 24 // Specializations of the templatized GenericNode<> class must provide a base |
| 30 // class B that contains all of the members to be made available in each | 25 // class B that contains all of the members to be made available in each |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 inline void AppendUse(Use* use); | 125 inline void AppendUse(Use* use); |
| 131 inline void RemoveUse(Use* use); | 126 inline void RemoveUse(Use* use); |
| 132 | 127 |
| 133 void* operator new(size_t, void* location) { return location; } | 128 void* operator new(size_t, void* location) { return location; } |
| 134 | 129 |
| 135 GenericNode(GenericGraphBase* graph, int input_count); | 130 GenericNode(GenericGraphBase* graph, int input_count); |
| 136 | 131 |
| 137 private: | 132 private: |
| 138 void AssignUniqueID(GenericGraphBase* graph); | 133 void AssignUniqueID(GenericGraphBase* graph); |
| 139 | 134 |
| 140 typedef zone_allocator<Input> ZoneInputAllocator; | 135 typedef ZoneDeque<Input> InputDeque; |
| 141 typedef std::deque<Input, ZoneInputAllocator> InputDeque; | |
| 142 | 136 |
| 143 NodeId id_; | 137 NodeId id_; |
| 144 int input_count_ : 31; | 138 int input_count_ : 31; |
| 145 bool has_appendable_inputs_ : 1; | 139 bool has_appendable_inputs_ : 1; |
| 146 union { | 140 union { |
| 147 // When a node is initially allocated, it uses a static buffer to hold its | 141 // When a node is initially allocated, it uses a static buffer to hold its |
| 148 // inputs under the assumption that the number of outputs will not increase. | 142 // inputs under the assumption that the number of outputs will not increase. |
| 149 // When the first input is appended, the static buffer is converted into a | 143 // When the first input is appended, the static buffer is converted into a |
| 150 // deque to allow for space-efficient growing. | 144 // deque to allow for space-efficient growing. |
| 151 Input* static_; | 145 Input* static_; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 262 } |
| 269 | 263 |
| 270 typename GenericNode<B, S>::Use* current_; | 264 typename GenericNode<B, S>::Use* current_; |
| 271 int index_; | 265 int index_; |
| 272 }; | 266 }; |
| 273 } | 267 } |
| 274 } | 268 } |
| 275 } // namespace v8::internal::compiler | 269 } // namespace v8::internal::compiler |
| 276 | 270 |
| 277 #endif // V8_COMPILER_GENERIC_NODE_H_ | 271 #endif // V8_COMPILER_GENERIC_NODE_H_ |
| OLD | NEW |