Lines Matching defs:node
7 #include "src/compiler/node-properties.h"
19 Reduction RedundancyElimination::Reduce(Node* node) {
20 if (node_checks_.Get(node)) return NoChange();
21 switch (node->opcode()) {
41 return ReduceCheckNode(node);
45 return ReduceSpeculativeNumberComparison(node);
51 return ReduceSpeculativeNumberOperation(node);
53 return ReduceEffectPhi(node);
57 return ReduceStart(node);
59 return ReduceOtherNode(node);
83 if (this_head->node != that_head->node) return false;
121 Node* node) const {
122 Check* head = zone->New<Check>(node, head_);
133 // CheckInternalizedString(node) implies CheckString(node)
136 // CheckSmi(node) implies CheckNumber(node)
139 // CheckedTaggedSignedToInt32(node) implies CheckedTaggedToInt32(node)
142 // CheckedTaggedSignedToInt32(node) implies
143 // CheckedTaggedToArrayIndex(node)
146 // CheckedTaggedToInt32(node) implies CheckedTaggedToArrayIndex(node)
149 // CheckReceiver(node) implies CheckReceiverOrNullOrUndefined(node)
213 bool TypeSubsumes(Node* node, Node* replacement) {
214 if (!NodeProperties::IsTyped(node) || !NodeProperties::IsTyped(replacement)) {
215 // If either node is untyped, we are running during an untyped optimization
219 Type node_type = NodeProperties::GetType(node);
226 Node* RedundancyElimination::EffectPathChecks::LookupCheck(Node* node) const {
228 if (CheckSubsumes(check->node, node) && TypeSubsumes(node, check->node)) {
229 DCHECK(!check->node->IsDead());
230 return check->node;
237 Node* node) const {
239 if (check->node->opcode() == IrOpcode::kCheckBounds &&
240 check->node->InputAt(0) == node && TypeSubsumes(node, check->node) &&
241 !(CheckBoundsParametersOf(check->node->op()).flags() &
243 return check->node;
250 RedundancyElimination::PathChecksForEffectNodes::Get(Node* node) const {
251 size_t const id = node->id();
257 Node* node, EffectPathChecks const* checks) {
258 size_t const id = node->id();
263 Reduction RedundancyElimination::ReduceCheckNode(Node* node) {
264 Node* const effect = NodeProperties::GetEffectInput(node);
270 if (Node* check = checks->LookupCheck(node)) {
271 ReplaceWithValue(node, check);
276 return UpdateChecks(node, checks->AddCheck(zone(), node));
279 Reduction RedundancyElimination::ReduceEffectPhi(Node* node) {
280 Node* const control = NodeProperties::GetControlInput(node);
285 return TakeChecksFromFirstEffect(node);
290 int const input_count = node->op()->EffectInputCount();
292 Node* const effect = NodeProperties::GetEffectInput(node, i);
299 zone(), node_checks_.Get(NodeProperties::GetEffectInput(node, 0)));
301 Node* const input = NodeProperties::GetEffectInput(node, i);
304 return UpdateChecks(node, checks);
307 Reduction RedundancyElimination::ReduceSpeculativeNumberComparison(Node* node) {
308 NumberOperationHint const hint = NumberOperationHintOf(node->op());
309 Node* const first = NodeProperties::GetValueInput(node, 0);
311 Node* const second = NodeProperties::GetValueInput(node, 1);
313 Node* const effect = NodeProperties::GetEffectInput(node);
320 // Avoid the potentially expensive lookups below if the {node}
336 NodeProperties::ReplaceValueInput(node, check, 0);
337 return Changed(node).FollowedBy(
338 ReduceSpeculativeNumberComparison(node));
354 NodeProperties::ReplaceValueInput(node, check, 1);
355 return Changed(node).FollowedBy(
356 ReduceSpeculativeNumberComparison(node));
362 return UpdateChecks(node, checks);
365 Reduction RedundancyElimination::ReduceSpeculativeNumberOperation(Node* node) {
366 DCHECK(node->opcode() == IrOpcode::kSpeculativeNumberAdd ||
367 node->opcode() == IrOpcode::kSpeculativeNumberSubtract ||
368 node->opcode() == IrOpcode::kSpeculativeSafeIntegerAdd ||
369 node->opcode() == IrOpcode::kSpeculativeSafeIntegerSubtract ||
370 node->opcode() == IrOpcode::kSpeculativeToNumber);
371 DCHECK_EQ(1, node->op()->EffectInputCount());
372 DCHECK_EQ(1, node->op()->EffectOutputCount());
374 Node* const first = NodeProperties::GetValueInput(node, 0);
375 Node* const effect = NodeProperties::GetEffectInput(node);
384 // for the {node} later on.
387 // than the type of the {first} node, otherwise we
391 NodeProperties::ReplaceValueInput(node, check, 0);
395 return UpdateChecks(node, checks);
398 Reduction RedundancyElimination::ReduceStart(Node* node) {
399 return UpdateChecks(node, EffectPathChecks::Empty(zone()));
402 Reduction RedundancyElimination::ReduceOtherNode(Node* node) {
403 if (node->op()->EffectInputCount() == 1) {
404 if (node->op()->EffectOutputCount() == 1) {
405 return TakeChecksFromFirstEffect(node);
411 DCHECK_EQ(0, node->op()->EffectInputCount());
412 DCHECK_EQ(0, node->op()->EffectOutputCount());
416 Reduction RedundancyElimination::TakeChecksFromFirstEffect(Node* node) {
417 DCHECK_EQ(1, node->op()->EffectOutputCount());
418 Node* const effect = NodeProperties::GetEffectInput(node);
425 return UpdateChecks(node, checks);
428 Reduction RedundancyElimination::UpdateChecks(Node* node,
430 EffectPathChecks const* original = node_checks_.Get(node);
431 // Only signal that the {node} has Changed, if the information about {checks}
435 node_checks_.Set(node, checks);
436 return Changed(node);