| 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" | 10 #include "src/compiler/generic-graph.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(GenericGraphBase* 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 size_t reserve_input_count = | 239 int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0; |
| 240 has_extensible_inputs ? kDefaultReservedInputs : 0; | |
| 241 size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input); | 240 size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input); |
| 242 size_t uses_size = input_count * sizeof(Use); | 241 size_t uses_size = input_count * sizeof(Use); |
| 243 int size = static_cast<int>(node_size + inputs_size + uses_size); | 242 int size = static_cast<int>(node_size + inputs_size + uses_size); |
| 244 Zone* zone = graph->zone(); | 243 Zone* zone = graph->zone(); |
| 245 void* buffer = zone->New(size); | 244 void* buffer = zone->New(size); |
| 246 S* result = new (buffer) S(graph, input_count, reserve_input_count); | 245 S* result = new (buffer) S(graph, input_count, reserve_input_count); |
| 247 Input* input = | 246 Input* input = |
| 248 reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size); | 247 reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size); |
| 249 Use* use = | 248 Use* use = |
| 250 reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size); | 249 reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size); |
| 251 | 250 |
| 252 for (int current = 0; current < input_count; ++current) { | 251 for (int current = 0; current < input_count; ++current) { |
| 253 GenericNode* to = *inputs++; | 252 GenericNode* to = *inputs++; |
| 254 input->to = to; | 253 input->to = to; |
| 255 input->use = use; | 254 input->use = use; |
| 256 use->input_index = current; | 255 use->input_index = current; |
| 257 use->from = result; | 256 use->from = result; |
| 258 to->AppendUse(use); | 257 to->AppendUse(use); |
| 259 ++use; | 258 ++use; |
| 260 ++input; | 259 ++input; |
| 261 } | 260 } |
| 262 return result; | 261 return result; |
| 263 } | 262 } |
| 264 } | 263 } |
| 265 } | 264 } |
| 266 } // namespace v8::internal::compiler | 265 } // namespace v8::internal::compiler |
| 267 | 266 |
| 268 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ | 267 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ |
| OLD | NEW |