| 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 #include "src/compiler/node.h" | 5 #include "src/compiler/node.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 namespace compiler { | 9 namespace compiler { |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 old_input_ptr++; | 43 old_input_ptr++; |
| 44 new_input_ptr++; | 44 new_input_ptr++; |
| 45 old_use_ptr--; | 45 old_use_ptr--; |
| 46 new_use_ptr--; | 46 new_use_ptr--; |
| 47 } | 47 } |
| 48 this->count_ = count; | 48 this->count_ = count; |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count, | 52 Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count, |
| 53 Node** inputs, bool has_extensible_inputs) { | 53 Node* const* inputs, bool has_extensible_inputs) { |
| 54 Node** input_ptr; | 54 Node** input_ptr; |
| 55 Use* use_ptr; | 55 Use* use_ptr; |
| 56 Node* node; | 56 Node* node; |
| 57 bool is_inline; | 57 bool is_inline; |
| 58 | 58 |
| 59 if (input_count > kMaxInlineCapacity) { | 59 if (input_count > kMaxInlineCapacity) { |
| 60 // Allocate out-of-line inputs. | 60 // Allocate out-of-line inputs. |
| 61 int capacity = | 61 int capacity = |
| 62 has_extensible_inputs ? input_count + kMaxInlineCapacity : input_count; | 62 has_extensible_inputs ? input_count + kMaxInlineCapacity : input_count; |
| 63 OutOfLineInputs* outline = OutOfLineInputs::New(zone, capacity); | 63 OutOfLineInputs* outline = OutOfLineInputs::New(zone, capacity); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 Use* use = use_ptr - 1 - current; | 99 Use* use = use_ptr - 1 - current; |
| 100 use->bit_field_ = Use::InputIndexField::encode(current) | | 100 use->bit_field_ = Use::InputIndexField::encode(current) | |
| 101 Use::InlineField::encode(is_inline); | 101 Use::InlineField::encode(is_inline); |
| 102 to->AppendUse(use); | 102 to->AppendUse(use); |
| 103 } | 103 } |
| 104 node->Verify(); | 104 node->Verify(); |
| 105 return node; | 105 return node; |
| 106 } | 106 } |
| 107 | 107 |
| 108 | 108 |
| 109 Node* Node::Clone(Zone* zone, NodeId id, const Node* node) { |
| 110 int const input_count = node->InputCount(); |
| 111 Node* const* const inputs = node->has_inline_inputs() |
| 112 ? node->inputs_.inline_ |
| 113 : node->inputs_.outline_->inputs_; |
| 114 Node* const clone = New(zone, id, node->op(), input_count, inputs, false); |
| 115 clone->set_bounds(node->bounds()); |
| 116 return clone; |
| 117 } |
| 118 |
| 119 |
| 109 void Node::Kill() { | 120 void Node::Kill() { |
| 110 DCHECK_NOT_NULL(op()); | 121 DCHECK_NOT_NULL(op()); |
| 111 NullAllInputs(); | 122 NullAllInputs(); |
| 112 DCHECK(uses().empty()); | 123 DCHECK(uses().empty()); |
| 113 } | 124 } |
| 114 | 125 |
| 115 | 126 |
| 116 void Node::AppendInput(Zone* zone, Node* new_to) { | 127 void Node::AppendInput(Zone* zone, Node* new_to) { |
| 117 DCHECK_NOT_NULL(zone); | 128 DCHECK_NOT_NULL(zone); |
| 118 DCHECK_NOT_NULL(new_to); | 129 DCHECK_NOT_NULL(new_to); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 ++(*this); | 395 ++(*this); |
| 385 return result; | 396 return result; |
| 386 } | 397 } |
| 387 | 398 |
| 388 | 399 |
| 389 bool Node::Uses::empty() const { return begin() == end(); } | 400 bool Node::Uses::empty() const { return begin() == end(); } |
| 390 | 401 |
| 391 } // namespace compiler | 402 } // namespace compiler |
| 392 } // namespace internal | 403 } // namespace internal |
| 393 } // namespace v8 | 404 } // namespace v8 |
| OLD | NEW |