5 #ifndef V8_COMPILER_NODE_PROPERTIES_H_ 6 #define V8_COMPILER_NODE_PROPERTIES_H_ 8 #include "src/compiler/node.h" 9 #include "src/compiler/types.h" 10 #include "src/globals.h" 11 #include "src/objects/map.h" 12 #include "src/zone/zone-handle-set.h" 20 class CommonOperatorBuilder;
30 static int FirstValueIndex(
Node* node) {
return 0; }
31 static int FirstContextIndex(
Node* node) {
return PastValueIndex(node); }
32 static int FirstFrameStateIndex(
Node* node) {
return PastContextIndex(node); }
33 static int FirstEffectIndex(
Node* node) {
return PastFrameStateIndex(node); }
34 static int FirstControlIndex(
Node* node) {
return PastEffectIndex(node); }
35 static int PastValueIndex(
Node* node);
36 static int PastContextIndex(
Node* node);
37 static int PastFrameStateIndex(
Node* node);
38 static int PastEffectIndex(
Node* node);
39 static int PastControlIndex(
Node* node);
45 static Node* GetValueInput(
Node* node,
int index);
46 static Node* GetContextInput(
Node* node);
47 static Node* GetFrameStateInput(
Node* node);
48 static Node* GetEffectInput(
Node* node,
int index = 0);
49 static Node* GetControlInput(
Node* node,
int index = 0);
55 static bool IsValueEdge(
Edge edge);
56 static bool IsContextEdge(
Edge edge);
57 static bool IsFrameStateEdge(
Edge edge);
58 static bool IsEffectEdge(
Edge edge);
59 static bool IsControlEdge(
Edge edge);
65 static bool IsCommon(
Node* node) {
66 return IrOpcode::IsCommonOpcode(node->opcode());
68 static bool IsControl(
Node* node) {
69 return IrOpcode::IsControlOpcode(node->opcode());
71 static bool IsConstant(
Node* node) {
72 return IrOpcode::IsConstantOpcode(node->opcode());
74 static bool IsPhi(
Node* node) {
75 return IrOpcode::IsPhiOpcode(node->opcode());
81 static bool IsExceptionalCall(
Node* node,
Node** out_exception =
nullptr);
85 static Node* FindSuccessfulControlProjection(
Node* node);
90 static void ReplaceValueInput(
Node* node,
Node* value,
int index);
91 static void ReplaceContextInput(
Node* node,
Node* context);
92 static void ReplaceControlInput(
Node* node,
Node* control,
int index = 0);
93 static void ReplaceEffectInput(
Node* node,
Node* effect,
int index = 0);
94 static void ReplaceFrameStateInput(
Node* node,
Node* frame_state);
95 static void RemoveNonValueInputs(
Node* node);
96 static void RemoveValueInputs(
Node* node);
99 static void ReplaceValueInputs(
Node* node,
Node* value);
109 static void ReplaceUses(
Node* node,
Node* value,
Node* effect =
nullptr,
110 Node* success =
nullptr,
Node* exception =
nullptr);
114 static void ChangeOp(
Node* node,
const Operator* new_op);
121 static Node* FindFrameStateBefore(
Node* node);
124 static Node* FindProjection(
Node* node,
size_t projection_index);
127 static void CollectValueProjections(
Node* node,
Node** proj,
size_t count);
134 static void CollectControlProjections(
Node* node,
Node** proj,
size_t count);
137 static bool IsSame(
Node* a,
Node* b);
141 static bool Equals(
Node* a,
Node* b);
143 static size_t HashCode(
Node* node);
148 enum InferReceiverMapsResult {
150 kReliableReceiverMaps,
151 kUnreliableReceiverMaps
154 static InferReceiverMapsResult InferReceiverMaps(
160 Node* effect, InstanceType instance_type);
165 static bool NoObservableSideEffectBetween(
Node* effect,
Node* dominator);
184 static Node* GetOuterContext(
Node* node,
size_t* depth);
189 static bool IsTyped(
Node* node) {
return !node->type().IsInvalid(); }
191 DCHECK(IsTyped(node));
194 static Type GetTypeOrAny(
Node* node);
196 DCHECK(!
type.IsInvalid());
197 node->set_type(
type);
199 static void RemoveType(
Node* node) { node->set_type(Type::Invalid()); }
200 static bool AllValueInputsAreTyped(
Node* node);
203 static inline bool IsInputRange(
Edge edge,
int first,
int count);
210 #endif // V8_COMPILER_NODE_PROPERTIES_H_