| 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_INL_H_ | 5 #ifndef V8_COMPILER_GENERIC_NODE_INL_H_ |
| 6 #define V8_COMPILER_GENERIC_NODE_INL_H_ | 6 #define V8_COMPILER_GENERIC_NODE_INL_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/compiler/generic-graph.h" | |
| 11 #include "src/compiler/generic-node.h" | 10 #include "src/compiler/generic-node.h" |
| 11 #include "src/compiler/graph.h" |
| 12 #include "src/zone.h" | 12 #include "src/zone.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 namespace compiler { | 16 namespace compiler { |
| 17 | 17 |
| 18 template <class B, class S> | 18 template <class B, class S> |
| 19 GenericNode<B, S>::GenericNode(GenericGraphBase* graph, int input_count, | 19 GenericNode<B, S>::GenericNode(Graph* graph, int input_count, |
| 20 int reserve_input_count) | 20 int reserve_input_count) |
| 21 : BaseClass(graph->zone()), | 21 : BaseClass(graph->zone()), |
| 22 input_count_(input_count), | 22 input_count_(input_count), |
| 23 reserve_input_count_(reserve_input_count), | 23 reserve_input_count_(reserve_input_count), |
| 24 has_appendable_inputs_(false), | 24 has_appendable_inputs_(false), |
| 25 use_count_(0), | 25 use_count_(0), |
| 26 first_use_(NULL), | 26 first_use_(NULL), |
| 27 last_use_(NULL) { | 27 last_use_(NULL) { |
| 28 DCHECK(reserve_input_count <= kMaxReservedInputs); | 28 DCHECK(reserve_input_count <= kMaxReservedInputs); |
| 29 inputs_.static_ = reinterpret_cast<Input*>(this + 1); | 29 inputs_.static_ = reinterpret_cast<Input*>(this + 1); |
| 30 AssignUniqueID(graph); | 30 AssignUniqueID(graph); |
| 31 } | 31 } |
| 32 | 32 |
| 33 template <class B, class S> | 33 template <class B, class S> |
| 34 inline void GenericNode<B, S>::AssignUniqueID(GenericGraphBase* graph) { | 34 inline void GenericNode<B, S>::AssignUniqueID(Graph* graph) { |
| 35 id_ = graph->NextNodeID(); | 35 id_ = graph->NextNodeID(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 template <class B, class S> | 38 template <class B, class S> |
| 39 inline typename GenericNode<B, S>::Inputs::iterator | 39 inline typename GenericNode<B, S>::Inputs::iterator |
| 40 GenericNode<B, S>::Inputs::begin() { | 40 GenericNode<B, S>::Inputs::begin() { |
| 41 return typename GenericNode<B, S>::Inputs::iterator(this->node_, 0); | 41 return typename GenericNode<B, S>::Inputs::iterator(this->node_, 0); |
| 42 } | 42 } |
| 43 | 43 |
| 44 template <class B, class S> | 44 template <class B, class S> |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 --use_count_; | 226 --use_count_; |
| 227 } | 227 } |
| 228 | 228 |
| 229 template <class B, class S> | 229 template <class B, class S> |
| 230 inline bool GenericNode<B, S>::OwnedBy(GenericNode* owner) const { | 230 inline bool GenericNode<B, S>::OwnedBy(GenericNode* owner) const { |
| 231 return first_use_ != NULL && first_use_->from == owner && | 231 return first_use_ != NULL && first_use_->from == owner && |
| 232 first_use_->next == NULL; | 232 first_use_->next == NULL; |
| 233 } | 233 } |
| 234 | 234 |
| 235 template <class B, class S> | 235 template <class B, class S> |
| 236 S* GenericNode<B, S>::New(GenericGraphBase* graph, int input_count, S** inputs, | 236 S* GenericNode<B, S>::New(Graph* graph, int input_count, S** inputs, |
| 237 bool has_extensible_inputs) { | 237 bool has_extensible_inputs) { |
| 238 size_t node_size = sizeof(GenericNode); | 238 size_t node_size = sizeof(GenericNode); |
| 239 int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0; | 239 int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0; |
| 240 size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input); | 240 size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input); |
| 241 size_t uses_size = input_count * sizeof(Use); | 241 size_t uses_size = input_count * sizeof(Use); |
| 242 int size = static_cast<int>(node_size + inputs_size + uses_size); | 242 int size = static_cast<int>(node_size + inputs_size + uses_size); |
| 243 Zone* zone = graph->zone(); | 243 Zone* zone = graph->zone(); |
| 244 void* buffer = zone->New(size); | 244 void* buffer = zone->New(size); |
| 245 S* result = new (buffer) S(graph, input_count, reserve_input_count); | 245 S* result = new (buffer) S(graph, input_count, reserve_input_count); |
| 246 Input* input = | 246 Input* input = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 258 ++use; | 258 ++use; |
| 259 ++input; | 259 ++input; |
| 260 } | 260 } |
| 261 return result; | 261 return result; |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 } // namespace v8::internal::compiler | 265 } // namespace v8::internal::compiler |
| 266 | 266 |
| 267 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ | 267 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ |
| OLD | NEW |