5#ifndef V8_COMPILER_NODE_PROPERTIES_H_
6#define V8_COMPILER_NODE_PROPERTIES_H_
21class CommonOperatorBuilder;
38 return FirstValueIndex(node) + node->op()->ValueInputCount();
42 return FirstContextIndex(node) +
43 OperatorProperties::GetContextInputCount(node->op());
47 return FirstFrameStateIndex(node) +
48 OperatorProperties::GetFrameStateInputCount(node->op());
52 return FirstEffectIndex(node) + node->op()->EffectInputCount();
56 return FirstControlIndex(node) + node->op()->ControlInputCount();
64 CHECK_LT(index, node->op()->ValueInputCount());
65 return node->InputAt(FirstValueIndex(node) + index);
70 CHECK_LT(index, node->op()->ValueInputCount());
71 return node->InputAt(FirstValueIndex(node) + index);
75 CHECK(OperatorProperties::HasContextInput(node->op()));
76 return node->InputAt(FirstContextIndex(node));
80 CHECK(OperatorProperties::HasFrameStateInput(node->op()));
81 return node->InputAt(FirstFrameStateIndex(node));
86 CHECK_LT(index, node->op()->EffectInputCount());
87 return node->InputAt(FirstEffectIndex(node) + index);
92 CHECK_LT(index, node->op()->ControlInputCount());
93 return node->InputAt(FirstControlIndex(node) + index);
99 static bool IsValueEdge(
Edge edge);
100 static bool IsContextEdge(
Edge edge);
101 static bool IsFrameStateEdge(
Edge edge);
102 static bool IsEffectEdge(
Edge edge);
103 static bool IsControlEdge(
Edge edge);
109 return IrOpcode::IsCommonOpcode(node->opcode());
112 return IrOpcode::IsControlOpcode(node->opcode());
115 return IrOpcode::IsConstantOpcode(node->opcode());
118 return IrOpcode::IsPhiOpcode(node->opcode());
120#if V8_ENABLE_WEBASSEMBLY
121 static bool IsSimd128Operation(
Node* node) {
122 return IrOpcode::IsSimd128Opcode(node->opcode());
129 static bool IsExceptionalCall(Node* node, Node** out_exception =
nullptr);
133 static Node* FindSuccessfulControlProjection(Node* node);
138 switch (node->opcode()) {
139 case IrOpcode::kTypeGuard:
140 *out_value = GetValueInput(node, 0);
150 static void ReplaceValueInput(
Node* node,
Node* value,
int index);
151 static void ReplaceContextInput(
Node* node,
Node* context);
152 static void ReplaceControlInput(
Node* node,
Node* control,
int index = 0);
153 static void ReplaceEffectInput(
Node* node,
Node* effect,
int index = 0);
154 static void ReplaceFrameStateInput(
Node* node,
Node* frame_state);
155 static void RemoveNonValueInputs(
Node* node);
156 static void RemoveValueInputs(
Node* node);
159 static void ReplaceValueInputs(
Node* node,
Node* value);
168 static void RemoveControlFromEnd(
TFGraph* graph,
174 static void ReplaceUses(
Node* node,
Node* value,
Node* effect =
nullptr,
175 Node* success =
nullptr,
Node* exception =
nullptr);
181 static void ChangeOpUnchecked(
Node* node,
const Operator* new_op);
189 static Node* FindFrameStateBefore(
Node* node,
Node* unreachable_sentinel);
192 static Node* FindProjection(
Node* node,
size_t projection_index);
195 static void CollectValueProjections(
Node* node,
Node** proj,
size_t count);
202 static void CollectControlProjections(
Node* node,
Node** proj,
size_t count);
208 static bool IsSame(
Node* a,
Node* b);
212 static bool Equals(
Node* a,
Node* b);
214 static size_t HashCode(
Node* node);
235 static bool NoObservableSideEffectBetween(
Node* effect,
Node* dominator);
254 static Node* GetOuterContext(
Node* node,
size_t* depth);
259 static bool IsTyped(
const Node* node) {
return !node->type().IsInvalid(); }
264 static Type GetTypeOrAny(
const Node* node);
266 DCHECK(!type.IsInvalid());
267 node->set_type(type);
270 static bool AllValueInputsAreTyped(
Node* node);
273 static inline bool IsInputRange(
Edge edge,
int first,
int count);
static int FirstEffectIndex(Node *node)
static bool IsValueIdentity(Node *node, Node **out_value)
static Type GetType(const Node *node)
static bool IsCommon(Node *node)
static bool IsControl(Node *node)
static bool IsTyped(const Node *node)
static int PastEffectIndex(Node *node)
static Node * GetEffectInput(Node *node, int index=0)
static int FirstFrameStateIndex(Node *node)
static int PastControlIndex(Node *node)
static int FirstContextIndex(Node *node)
static int PastValueIndex(Node *node)
static Node * GetContextInput(Node *node)
static void RemoveType(Node *node)
static Node * GetFrameStateInput(Node *node)
static Node * GetValueInput(Node *node, int index)
static void SetType(Node *node, Type type)
static const Node * GetValueInput(const Node *node, int index)
static int FirstControlIndex(Node *node)
static bool IsConstant(Node *node)
static int FirstValueIndex(const Node *node)
static bool IsPhi(Node *node)
static Node * GetControlInput(Node *node, int index=0)
static int PastFrameStateIndex(Node *node)
static int PastContextIndex(Node *node)
#define CHECK_LT(lhs, rhs)
#define CHECK_LE(lhs, rhs)
#define DCHECK(condition)
#define V8_EXPORT_PRIVATE