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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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* const* 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 DEBUG |
| 60 // Verify that none of the inputs are {nullptr}. |
| 61 for (int i = 0; i < input_count; i++) { |
| 62 if (inputs[i] == nullptr) { |
| 63 V8_Fatal(__FILE__, __LINE__, "Node::New() Error: #%d:%s[%d] is NULL", |
| 64 static_cast<int>(id), op->mnemonic(), i); |
| 65 } |
| 66 } |
| 67 #endif |
| 68 |
59 if (input_count > kMaxInlineCapacity) { | 69 if (input_count > kMaxInlineCapacity) { |
60 // Allocate out-of-line inputs. | 70 // Allocate out-of-line inputs. |
61 int capacity = | 71 int capacity = |
62 has_extensible_inputs ? input_count + kMaxInlineCapacity : input_count; | 72 has_extensible_inputs ? input_count + kMaxInlineCapacity : input_count; |
63 OutOfLineInputs* outline = OutOfLineInputs::New(zone, capacity); | 73 OutOfLineInputs* outline = OutOfLineInputs::New(zone, capacity); |
64 | 74 |
65 // Allocate node. | 75 // Allocate node. |
66 void* node_buffer = zone->New(sizeof(Node)); | 76 void* node_buffer = zone->New(sizeof(Node)); |
67 node = new (node_buffer) Node(id, op, kOutlineMarker, 0); | 77 node = new (node_buffer) Node(id, op, kOutlineMarker, 0); |
68 node->inputs_.outline_ = outline; | 78 node->inputs_.outline_ = outline; |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 ++(*this); | 412 ++(*this); |
403 return result; | 413 return result; |
404 } | 414 } |
405 | 415 |
406 | 416 |
407 bool Node::Uses::empty() const { return begin() == end(); } | 417 bool Node::Uses::empty() const { return begin() == end(); } |
408 | 418 |
409 } // namespace compiler | 419 } // namespace compiler |
410 } // namespace internal | 420 } // namespace internal |
411 } // namespace v8 | 421 } // namespace v8 |
OLD | NEW |