Lines Matching refs:Node
5 #include "src/compiler/node-properties.h"
10 #include "src/compiler/node-matchers.h"
23 int NodeProperties::PastValueIndex(Node* node) {
24 return FirstValueIndex(node) + node->op()->ValueInputCount();
29 int NodeProperties::PastContextIndex(Node* node) {
30 return FirstContextIndex(node) +
31 OperatorProperties::GetContextInputCount(node->op());
36 int NodeProperties::PastFrameStateIndex(Node* node) {
37 return FirstFrameStateIndex(node) +
38 OperatorProperties::GetFrameStateInputCount(node->op());
43 int NodeProperties::PastEffectIndex(Node* node) {
44 return FirstEffectIndex(node) + node->op()->EffectInputCount();
49 int NodeProperties::PastControlIndex(Node* node) {
50 return FirstControlIndex(node) + node->op()->ControlInputCount();
55 Node* NodeProperties::GetValueInput(Node* node, int index) {
56 DCHECK(0 <= index && index < node->op()->ValueInputCount());
57 return node->InputAt(FirstValueIndex(node) + index);
62 Node* NodeProperties::GetContextInput(Node* node) {
63 DCHECK(OperatorProperties::HasContextInput(node->op()));
64 return node->InputAt(FirstContextIndex(node));
69 Node* NodeProperties::GetFrameStateInput(Node* node) {
70 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
71 return node->InputAt(FirstFrameStateIndex(node));
76 Node* NodeProperties::GetEffectInput(Node* node, int index) {
77 DCHECK(0 <= index && index < node->op()->EffectInputCount());
78 return node->InputAt(FirstEffectIndex(node) + index);
83 Node* NodeProperties::GetControlInput(Node* node, int index) {
84 DCHECK(0 <= index && index < node->op()->ControlInputCount());
85 return node->InputAt(FirstControlIndex(node) + index);
91 Node* const node = edge.from();
92 return IsInputRange(edge, FirstValueIndex(node),
93 node->op()->ValueInputCount());
99 Node* const node = edge.from();
100 return IsInputRange(edge, FirstContextIndex(node),
101 OperatorProperties::GetContextInputCount(node->op()));
107 Node* const node = edge.from();
108 return IsInputRange(edge, FirstFrameStateIndex(node),
109 OperatorProperties::GetFrameStateInputCount(node->op()));
115 Node* const node = edge.from();
116 return IsInputRange(edge, FirstEffectIndex(node),
117 node->op()->EffectInputCount());
123 Node* const node = edge.from();
124 return IsInputRange(edge, FirstControlIndex(node),
125 node->op()->ControlInputCount());
130 bool NodeProperties::IsExceptionalCall(Node* node, Node** out_exception) {
131 if (node->op()->HasProperty(Operator::kNoThrow)) return false;
132 for (Edge const edge : node->use_edges()) {
143 Node* NodeProperties::FindSuccessfulControlProjection(Node* node) {
144 DCHECK_GT(node->op()->ControlOutputCount(), 0);
145 if (node->op()->HasProperty(Operator::kNoThrow)) return node;
146 for (Edge const edge : node->use_edges()) {
152 return node;
156 void NodeProperties::ReplaceValueInput(Node* node, Node* value, int index) {
157 DCHECK(index < node->op()->ValueInputCount());
158 node->ReplaceInput(FirstValueIndex(node) + index, value);
163 void NodeProperties::ReplaceValueInputs(Node* node, Node* value) {
164 int value_input_count = node->op()->ValueInputCount();
166 node->ReplaceInput(0, value);
168 node->RemoveInput(value_input_count);
174 void NodeProperties::ReplaceContextInput(Node* node, Node* context) {
175 node->ReplaceInput(FirstContextIndex(node), context);
180 void NodeProperties::ReplaceControlInput(Node* node, Node* control, int index) {
181 DCHECK(index < node->op()->ControlInputCount());
182 node->ReplaceInput(FirstControlIndex(node) + index, control);
187 void NodeProperties::ReplaceEffectInput(Node* node, Node* effect, int index) {
188 DCHECK(index < node->op()->EffectInputCount());
189 return node->ReplaceInput(FirstEffectIndex(node) + index, effect);
194 void NodeProperties::ReplaceFrameStateInput(Node* node, Node* frame_state) {
195 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
196 node->ReplaceInput(FirstFrameStateIndex(node), frame_state);
201 void NodeProperties::RemoveNonValueInputs(Node* node) {
202 node->TrimInputCount(node->op()->ValueInputCount());
207 void NodeProperties::RemoveValueInputs(Node* node) {
208 int value_input_count = node->op()->ValueInputCount();
210 node->RemoveInput(value_input_count);
217 Node* node) {
218 graph->end()->AppendInput(graph->zone(), node);
224 void NodeProperties::ReplaceUses(Node* node, Node* value, Node* effect,
225 Node* success, Node* exception) {
227 for (Edge edge : node->use_edges()) {
251 void NodeProperties::ChangeOp(Node* node, const Operator* new_op) {
252 node->set_op(new_op);
253 Verifier::VerifyNode(node);
258 Node* NodeProperties::FindFrameStateBefore(Node* node) {
259 Node* effect = NodeProperties::GetEffectInput(node);
265 Node* frame_state = GetFrameStateInput(effect);
270 Node* NodeProperties::FindProjection(Node* node, size_t projection_index) {
271 for (auto use : node->uses()) {
282 void NodeProperties::CollectValueProjections(Node* node, Node** projections,
289 for (Edge const edge : node->use_edges()) {
291 Node* use = edge.from();
299 void NodeProperties::CollectControlProjections(Node* node, Node** projections,
302 DCHECK_LE(static_cast<int>(projection_count), node->UseCount());
306 for (Edge const edge : node->use_edges()) {
308 Node* use = edge.from();
312 DCHECK_EQ(IrOpcode::kBranch, node->opcode());
316 DCHECK_EQ(IrOpcode::kBranch, node->opcode());
320 DCHECK(!node->op()->HasProperty(Operator::kNoThrow));
324 DCHECK(!node->op()->HasProperty(Operator::kNoThrow));
328 DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
332 DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
351 bool NodeProperties::IsSame(Node* a, Node* b) {
367 Isolate* isolate, Node* receiver, Node* effect,
396 Node* const object = GetValueInput(effect, 0);
404 Node* const object = GetValueInput(effect, 0);
436 Node* const object = GetValueInput(effect, 0);
441 Node* const value = GetValueInput(effect, 1);
469 Node* control = GetControlInput(effect);
485 // Didn't find any appropriate CheckMaps node.
508 MaybeHandle<Map> NodeProperties::GetMapWitness(Isolate* isolate, Node* node) {
510 Node* receiver = NodeProperties::GetValueInput(node, 1);
511 Node* effect = NodeProperties::GetEffectInput(node);
521 Node* receiver,
522 Node* effect,
544 bool NodeProperties::NoObservableSideEffectBetween(Node* effect,
545 Node* dominator) {
558 bool NodeProperties::CanBePrimitive(Isolate* isolate, Node* receiver,
559 Node* effect) {
593 bool NodeProperties::CanBeNullOrUndefined(Isolate* isolate, Node* receiver,
594 Node* effect) {
623 Node* NodeProperties::GetOuterContext(Node* node, size_t* depth) {
624 Node* context = NodeProperties::GetContextInput(node);
634 Type NodeProperties::GetTypeOrAny(Node* node) {
635 return IsTyped(node) ? node->type() : Type::Any();
640 bool NodeProperties::AllValueInputsAreTyped(Node* node) {
641 int input_count = node->op()->ValueInputCount();
643 if (!IsTyped(GetValueInput(node, index))) return false;
657 size_t NodeProperties::HashCode(Node* node) {
658 size_t h = base::hash_combine(node->op()->HashCode(), node->InputCount());
659 for (Node* input : node->inputs()) {
666 bool NodeProperties::Equals(Node* a, Node* b) {
673 Node::Inputs aInputs = a->inputs();
674 Node::Inputs bInputs = b->inputs();