Lines Matching refs:node

9 #include "src/compiler/node-aux-data-inl.h"
10 #include "src/compiler/node-properties-inl.h"
23 // Relax the effects of {node} by immediately replacing effect uses of {node}
24 // with the effect input to {node}.
25 // TODO(turbofan): replace the effect input to {node} with {graph->start()}.
27 static void RelaxEffects(Node* node) {
28 NodeProperties::ReplaceWithValue(node, node, NULL);
35 Reduction JSTypedLowering::ReplaceEagerly(Node* old, Node* node) {
36 NodeProperties::ReplaceWithValue(old, node, node);
37 return Changed(node);
41 // A helper class to simplify the process of reducing a single binop node with a
47 JSBinopReduction(JSTypedLowering* lowering, Node* node)
49 node_(node),
50 left_type_(NodeProperties::GetBounds(node->InputAt(0)).upper),
51 right_type_(NodeProperties::GetBounds(node->InputAt(1)).upper) {}
84 // Remove all effect and control inputs and outputs to this node and change
92 // Remove the effects from the node, if any, and update its effect usages.
142 Node* node_; // The original node.
146 Node* ConvertToString(Node* node) {
148 Reduction reduced = lowering_->ReduceJSToStringInput(node);
150 Node* n = graph()->NewNode(javascript()->ToString(), node, context(),
156 Node* ConvertToNumber(Node* node) {
158 Reduction reduced = lowering_->ReduceJSToNumberInput(node);
160 Node* n = graph()->NewNode(javascript()->ToNumber(), node, context(),
167 bool TryNarrowingToI32(Type* type, Node* node) {
168 switch (node->opcode()) {
171 JSBinopReduction r(lowering_, node);
173 node->set_op(lowering_->machine()->Int32Add());
175 NodeProperties::SetBounds(node, Bounds(type));
181 JSBinopReduction r(lowering_, node);
183 node->set_op(lowering_->machine()->Int32Sub());
185 NodeProperties::SetBounds(node, Bounds(type));
194 Node* ConvertToI32(bool is_signed, Node* node) {
196 if (node->OwnedBy(node_)) {
197 // If this node {node_} has the only edge to {node}, then try narrowing
199 if (TryNarrowingToI32(type, node)) return node;
201 // Otherwise, {node} has multiple uses. Leave it as is and let the
207 node = ConvertToNumber(node);
208 Type* input_type = NodeProperties::GetBounds(node).upper;
210 if (input_type->Is(type)) return node; // already in the value range.
214 Node* n = graph()->NewNode(op, node);
224 Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
225 JSBinopReduction r(this, node);
253 Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
255 JSBinopReduction r(this, node);
268 Reduction JSTypedLowering::ReduceI32Binop(Node* node, bool left_signed,
271 JSBinopReduction r(this, node);
281 Reduction JSTypedLowering::ReduceI32Shift(Node* node, bool left_signed,
283 JSBinopReduction r(this, node);
289 Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
290 JSBinopReduction r(this, node);
294 switch (node->opcode()) {
332 switch (node->opcode()) {
357 Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) {
358 JSBinopReduction r(this, node);
377 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
378 JSBinopReduction r(this, node);
382 return ReplaceEagerly(node, invert ? jsgraph()->FalseConstant()
390 return ReplaceEagerly(node, invert ? jsgraph()->TrueConstant()
528 Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
529 Node* key = NodeProperties::GetValueInput(node, 1);
530 Node* base = NodeProperties::GetValueInput(node, 0);
548 NodeProperties::GetEffectInput(node));
552 elements, NodeProperties::GetEffectInput(node));
561 NodeProperties::GetEffectInput(node));
562 return ReplaceEagerly(node, value);
568 Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
569 Node* key = NodeProperties::GetValueInput(node, 1);
570 Node* base = NodeProperties::GetValueInput(node, 0);
571 Node* value = NodeProperties::GetValueInput(node, 2);
588 NodeProperties::GetEffectInput(node));
592 elements, NodeProperties::GetEffectInput(node));
602 NodeProperties::GetControlInput(node));
608 NodeProperties::GetEffectInput(node), if_true);
614 NodeProperties::GetEffectInput(node), merge);
622 static Reduction ReplaceWithReduction(Node* node, Reduction reduction) {
624 NodeProperties::ReplaceWithValue(node, reduction.replacement());
631 Reduction JSTypedLowering::Reduce(Node* node) {
632 switch (node->opcode()) {
634 return ReduceJSEqual(node, false);
636 return ReduceJSEqual(node, true);
638 return ReduceJSStrictEqual(node, false);
640 return ReduceJSStrictEqual(node, true);
645 return ReduceJSComparison(node);
647 return ReduceI32Binop(node, true, true, machine()->Word32Or());
649 return ReduceI32Binop(node, true, true, machine()->Word32Xor());
651 return ReduceI32Binop(node, true, true, machine()->Word32And());
653 return ReduceI32Shift(node, true, machine()->Word32Shl());
655 return ReduceI32Shift(node, true, machine()->Word32Sar());
657 return ReduceI32Shift(node, false, machine()->Word32Shr());
659 return ReduceJSAdd(node);
661 return ReduceNumberBinop(node, simplified()->NumberSubtract());
663 return ReduceNumberBinop(node, simplified()->NumberMultiply());
665 return ReduceNumberBinop(node, simplified()->NumberDivide());
667 return ReduceNumberBinop(node, simplified()->NumberModulus());
669 Reduction result = ReduceJSToBooleanInput(node->InputAt(0));
675 NodeProperties::ReplaceWithValue(node, value);
679 value = graph()->NewNode(simplified()->BooleanNot(), node);
680 node->set_op(javascript()->ToBoolean());
681 NodeProperties::ReplaceWithValue(node, value, node);
683 value->ReplaceInput(0, node);
684 return Changed(node);
688 return ReplaceWithReduction(node,
689 ReduceJSToBooleanInput(node->InputAt(0)));
691 return ReplaceWithReduction(node,
692 ReduceJSToNumberInput(node->InputAt(0)));
694 return ReplaceWithReduction(node,
695 ReduceJSToStringInput(node->InputAt(0)));
697 return ReduceJSLoadProperty(node);
699 return ReduceJSStoreProperty(node);
701 return JSBuiltinReducer(jsgraph()).Reduce(node);