diff options
Diffstat (limited to 'deps/v8/src/compiler/generic-node-inl.h')
-rw-r--r-- | deps/v8/src/compiler/generic-node-inl.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/deps/v8/src/compiler/generic-node-inl.h b/deps/v8/src/compiler/generic-node-inl.h index c2dc24ee83..afbd1f0ebf 100644 --- a/deps/v8/src/compiler/generic-node-inl.h +++ b/deps/v8/src/compiler/generic-node-inl.h @@ -16,14 +16,18 @@ namespace internal { namespace compiler { template <class B, class S> -GenericNode<B, S>::GenericNode(GenericGraphBase* graph, int input_count) +GenericNode<B, S>::GenericNode(GenericGraphBase* graph, int input_count, + int reserve_input_count) : BaseClass(graph->zone()), input_count_(input_count), + reserve_input_count_(reserve_input_count), has_appendable_inputs_(false), use_count_(0), first_use_(NULL), last_use_(NULL) { - inputs_.static_ = reinterpret_cast<Input*>(this + 1), AssignUniqueID(graph); + DCHECK(reserve_input_count <= kMaxReservedInputs); + inputs_.static_ = reinterpret_cast<Input*>(this + 1); + AssignUniqueID(graph); } template <class B, class S> @@ -153,12 +157,18 @@ void GenericNode<B, S>::EnsureAppendableInputs(Zone* zone) { template <class B, class S> void GenericNode<B, S>::AppendInput(Zone* zone, GenericNode<B, S>* to_append) { - EnsureAppendableInputs(zone); Use* new_use = new (zone) Use; Input new_input; new_input.to = to_append; new_input.use = new_use; - inputs_.appendable_->push_back(new_input); + if (reserve_input_count_ > 0) { + DCHECK(!has_appendable_inputs_); + reserve_input_count_--; + inputs_.static_[input_count_] = new_input; + } else { + EnsureAppendableInputs(zone); + inputs_.appendable_->push_back(new_input); + } new_use->input_index = input_count_; new_use->from = this; to_append->AppendUse(new_use); @@ -223,15 +233,16 @@ inline bool GenericNode<B, S>::OwnedBy(GenericNode* owner) const { } template <class B, class S> -S* GenericNode<B, S>::New(GenericGraphBase* graph, int input_count, - S** inputs) { +S* GenericNode<B, S>::New(GenericGraphBase* graph, int input_count, S** inputs, + bool has_extensible_inputs) { size_t node_size = sizeof(GenericNode); - size_t inputs_size = input_count * sizeof(Input); + int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0; + size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input); size_t uses_size = input_count * sizeof(Use); int size = static_cast<int>(node_size + inputs_size + uses_size); Zone* zone = graph->zone(); void* buffer = zone->New(size); - S* result = new (buffer) S(graph, input_count); + S* result = new (buffer) S(graph, input_count, reserve_input_count); Input* input = reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size); Use* use = |