28 Use* new_use_ptr =
reinterpret_cast<Use*
>(
this) - 1;
31 for (
int current = 0; current <
count; current++) {
36 Node* old_to = *old_input_ptr;
38 *old_input_ptr =
nullptr;
40 *new_input_ptr = old_to;
43 *new_input_ptr =
nullptr;
57template <
typename NodePtrT>
59 NodePtrT
const*
inputs,
bool has_extensible_inputs) {
70 for (
int i = 0;
i < input_count;
i++) {
72 FATAL(
"Node::New() Error: #%d:%s[%d] is nullptr",
static_cast<int>(
id),
87 node->set_outline_inputs(outline);
90 outline->
count_ = input_count;
92 input_ptr = outline->
inputs();
93 use_ptr =
reinterpret_cast<Use*
>(outline);
98 int capacity = std::max(1, input_count);
99 if (has_extensible_inputs) {
101 capacity = std::min(input_count + 3, max);
105 intptr_t raw_buffer =
108 reinterpret_cast<void*
>(raw_buffer + capacity *
sizeof(
Use));
110 node =
new (node_buffer)
Node(
id,
op, input_count, capacity);
111 input_ptr = node->inline_inputs();
112 use_ptr =
reinterpret_cast<Use*
>(
node);
119 for (
int current = 0; current < input_count; ++
current) {
132 Node*
const*
inputs,
bool has_extensible_inputs) {
133 return NewImpl(zone,
id,
op, input_count,
inputs, has_extensible_inputs);
137 int const input_count = node->InputCount();
139 ? node->inline_inputs()
140 : node->outline_inputs()->inputs();
142 clone->set_type(node->type());
160 if (inline_count < inline_capacity) {
176 outline->
node_ =
this;
186 outline->
node_ =
this;
247 while (
count-- > 0) {
249 Node* input = *input_ptr;
250 *input_ptr =
nullptr;
264 DCHECK_LE(new_input_count, current_count);
265 if (new_input_count == current_count)
return;
266 ClearInputs(new_input_count, current_count - new_input_count);
277 if (current_count > new_input_count) {
279 }
else if (current_count < new_input_count) {
284 }
while (current_count < new_input_count);
299 if (use->from()->opcode() == IrOpcode::kBranch) {
311 Use* last_use =
nullptr;
313 *use->input_ptr() = that;
318 last_use->
next = that->first_use_;
319 if (that->first_use_) that->first_use_->prev = last_use;
327 if (use->from() != owner) {
337 Node* from = use->from();
338 if (from == owner1) {
340 }
else if (from == owner2) {
355void PrintNode(
const Node* node, std::ostream& os,
int depth,
356 int indentation = 0) {
357 for (
int i = 0;
i < indentation; ++
i) {
361 os << *node << std::endl;
363 os <<
"(NULL)" << std::endl;
366 if (depth <= 0)
return;
367 for (
Node* input : node->inputs()) {
368 PrintNode(input, os, depth - 1, indentation + 1);
374 PrintNode(
this, os, depth);
378 os << n.id() <<
": " << *n.op();
379 if (n.InputCount() > 0) {
381 for (
int i = 0;
i < n.InputCount(); ++
i) {
382 if (
i != 0) os <<
", ";
384 os << n.InputAt(
i)->id();
401 static_assert(IdField::kMax < std::numeric_limits<NodeId>::max());
423 use->prev->next = use->next;
429 use->next->prev = use->prev;
441 if (count > 200 &&
count % 100)
return;
509 reinterpret_cast<i::compiler::Node*
>(object)->
Print();
static constexpr T decode(U value)
static constexpr bool is_valid(T value)
static constexpr U encode(T value)
static V8_NODISCARD constexpr U update(U previous, T value)
bool supports_compression() const
void * Allocate(size_t size)
const_iterator & operator++()
static Node * New(Zone *zone, NodeId id, const Operator *op, int input_count, Node *const *inputs, bool has_extensible_inputs)
int BranchUseCount() const
static Node * Clone(Zone *zone, NodeId id, const Node *node)
ZoneNodePtr * GetInputPtr(int input_index)
GraphZoneTraits::Ptr< OutOfLineInputs > ZoneOutOfLineInputsPtr
bool has_inline_inputs() const
static Node * NewImpl(Zone *zone, NodeId id, const Operator *op, int input_count, NodePtrT const *inputs, bool has_extensible_inputs)
Use * GetUsePtr(int input_index)
OutOfLineInputs * outline_inputs() const
Node(NodeId id, const Operator *op, int inline_count, int inline_capacity)
void ClearInputs(int start, int count)
void TrimInputCount(int new_input_count)
const Operator * op() const
void set_outline_inputs(OutOfLineInputs *outline)
void ReplaceInput(int index, Node *new_to)
Node * InputAt(int index) const
void InsertInputs(Zone *zone, int index, int count)
void AppendInput(Zone *zone, Node *new_to)
static const int kMaxInlineCapacity
bool OwnedBy(Node const *owner) const
Node * RemoveInput(int index)
static const int kOutlineMarker
void ReplaceUses(Node *replace_to)
void InsertInput(Zone *zone, int index, Node *new_to)
void EnsureInputCount(Zone *zone, int new_input_count)
ZoneVector< RpoNumber > & result
GraphZoneTraits::Ptr< Node > ZoneNodePtr
std::ostream & operator<<(std::ostream &os, AccessMode access_mode)
void Print(Tagged< Object > obj)
static constexpr bool kCompressGraphZone
other heap size generate builtins concurrently on separate threads in mksnapshot track concurrent recompilation artificial compilation delay in ms max number of threads that concurrent Turbofan can use(0 for unbounded)") DEFINE_BOOL( stress_concurrent_inlining
V8_DEBUGGING_EXPORT void _v8_internal_Node_Print(void *object)
#define V8_DEBUGGING_EXPORT
#define DCHECK_LE(v1, v2)
#define CHECK_IMPLIES(lhs, rhs)
#define DCHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
ZoneNodePtr * input_ptr()