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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return first_use_ != NULL && first_use_->from == owner && | 210 return first_use_ != NULL && first_use_->from == owner && |
211 first_use_->next == NULL; | 211 first_use_->next == NULL; |
212 } | 212 } |
213 | 213 |
214 template <class B, class S> | 214 template <class B, class S> |
215 S* GenericNode<B, S>::New(GenericGraphBase* graph, int input_count, | 215 S* GenericNode<B, S>::New(GenericGraphBase* graph, int input_count, |
216 S** inputs) { | 216 S** inputs) { |
217 size_t node_size = sizeof(GenericNode); | 217 size_t node_size = sizeof(GenericNode); |
218 size_t inputs_size = input_count * sizeof(Input); | 218 size_t inputs_size = input_count * sizeof(Input); |
219 size_t uses_size = input_count * sizeof(Use); | 219 size_t uses_size = input_count * sizeof(Use); |
220 size_t size = node_size + inputs_size + uses_size; | 220 int size = static_cast<int>(node_size + inputs_size + uses_size); |
221 Zone* zone = graph->zone(); | 221 Zone* zone = graph->zone(); |
222 void* buffer = zone->New(size); | 222 void* buffer = zone->New(size); |
223 S* result = new (buffer) S(graph, input_count); | 223 S* result = new (buffer) S(graph, input_count); |
224 Input* input = | 224 Input* input = |
225 reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size); | 225 reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size); |
226 Use* use = | 226 Use* use = |
227 reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size); | 227 reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size); |
228 | 228 |
229 for (int current = 0; current < input_count; ++current) { | 229 for (int current = 0; current < input_count; ++current) { |
230 GenericNode* to = *inputs++; | 230 GenericNode* to = *inputs++; |
231 input->to = to; | 231 input->to = to; |
232 input->use = use; | 232 input->use = use; |
233 use->input_index = current; | 233 use->input_index = current; |
234 use->from = result; | 234 use->from = result; |
235 to->AppendUse(use); | 235 to->AppendUse(use); |
236 ++use; | 236 ++use; |
237 ++input; | 237 ++input; |
238 } | 238 } |
239 return result; | 239 return result; |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 } // namespace v8::internal::compiler | 243 } // namespace v8::internal::compiler |
244 | 244 |
245 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ | 245 #endif // V8_COMPILER_GENERIC_NODE_INL_H_ |
OLD | NEW |