OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/graph-inl.h" | 6 #include "src/compiler/graph-inl.h" |
7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
8 #include "src/compiler/node-aux-data-inl.h" | 8 #include "src/compiler/node-aux-data-inl.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/types.h" | 10 #include "src/types.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 case IrOpcode::kJSMultiply: | 580 case IrOpcode::kJSMultiply: |
581 return ReduceNumberBinop(node, simplified()->NumberMultiply()); | 581 return ReduceNumberBinop(node, simplified()->NumberMultiply()); |
582 case IrOpcode::kJSDivide: | 582 case IrOpcode::kJSDivide: |
583 return ReduceNumberBinop(node, simplified()->NumberDivide()); | 583 return ReduceNumberBinop(node, simplified()->NumberDivide()); |
584 case IrOpcode::kJSModulus: | 584 case IrOpcode::kJSModulus: |
585 return ReduceNumberBinop(node, simplified()->NumberModulus()); | 585 return ReduceNumberBinop(node, simplified()->NumberModulus()); |
586 case IrOpcode::kJSUnaryNot: { | 586 case IrOpcode::kJSUnaryNot: { |
587 Reduction result = ReduceJSToBooleanInput(node->InputAt(0)); | 587 Reduction result = ReduceJSToBooleanInput(node->InputAt(0)); |
588 Node* value; | 588 Node* value; |
589 if (result.Changed()) { | 589 if (result.Changed()) { |
590 // !x => BooleanNot(x) | 590 // JSUnaryNot(x) => BooleanNot(x) |
591 value = | 591 value = |
592 graph()->NewNode(simplified()->BooleanNot(), result.replacement()); | 592 graph()->NewNode(simplified()->BooleanNot(), result.replacement()); |
593 NodeProperties::ReplaceWithValue(node, value); | 593 NodeProperties::ReplaceWithValue(node, value); |
594 return Changed(value); | 594 return Changed(value); |
595 } else { | 595 } else { |
596 // !x => BooleanNot(JSToBoolean(x)) | 596 // JSUnaryNot(x) => BooleanNot(JSToBoolean(x)) |
597 value = graph()->NewNode(simplified()->BooleanNot(), node); | 597 value = graph()->NewNode(simplified()->BooleanNot(), node); |
598 node->set_op(javascript()->ToBoolean()); | 598 node->set_op(javascript()->ToBoolean()); |
599 NodeProperties::ReplaceWithValue(node, value, node); | 599 NodeProperties::ReplaceWithValue(node, value, node); |
600 // Note: ReplaceUses() smashes all uses, so smash it back here. | 600 // Note: ReplaceUses() smashes all uses, so smash it back here. |
601 value->ReplaceInput(0, node); | 601 value->ReplaceInput(0, node); |
602 return ReplaceWith(value); | 602 return Changed(node); |
603 } | 603 } |
604 } | 604 } |
605 case IrOpcode::kJSToBoolean: | 605 case IrOpcode::kJSToBoolean: |
606 return ReplaceWithReduction(node, | 606 return ReplaceWithReduction(node, |
607 ReduceJSToBooleanInput(node->InputAt(0))); | 607 ReduceJSToBooleanInput(node->InputAt(0))); |
608 case IrOpcode::kJSToNumber: | 608 case IrOpcode::kJSToNumber: |
609 return ReplaceWithReduction(node, | 609 return ReplaceWithReduction(node, |
610 ReduceJSToNumberInput(node->InputAt(0))); | 610 ReduceJSToNumberInput(node->InputAt(0))); |
611 case IrOpcode::kJSToString: | 611 case IrOpcode::kJSToString: |
612 return ReplaceWithReduction(node, | 612 return ReplaceWithReduction(node, |
613 ReduceJSToStringInput(node->InputAt(0))); | 613 ReduceJSToStringInput(node->InputAt(0))); |
614 case IrOpcode::kJSLoadProperty: | 614 case IrOpcode::kJSLoadProperty: |
615 return ReduceJSPropertyLoad(node); | 615 return ReduceJSPropertyLoad(node); |
616 default: | 616 default: |
617 break; | 617 break; |
618 } | 618 } |
619 return NoChange(); | 619 return NoChange(); |
620 } | 620 } |
621 } | 621 } |
622 } | 622 } |
623 } // namespace v8::internal::compiler | 623 } // namespace v8::internal::compiler |
OLD | NEW |