Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 1471533002: [turbofan] Simplify lowering of number addition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 // => Float64Cmp 732 // => Float64Cmp
733 VisitFloat64Cmp(node); 733 VisitFloat64Cmp(node);
734 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); 734 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
735 } 735 }
736 break; 736 break;
737 } 737 }
738 case IrOpcode::kNumberAdd: 738 case IrOpcode::kNumberAdd:
739 case IrOpcode::kNumberSubtract: { 739 case IrOpcode::kNumberSubtract: {
740 // Add and subtract reduce to Int32Add/Sub if the inputs 740 // Add and subtract reduce to Int32Add/Sub if the inputs
741 // are already integers and all uses are truncating. 741 // are already integers and all uses are truncating.
742 if (CanLowerToInt32Binop(node, use)) { 742 if (CanLowerToWord32AdditiveBinop(node, use)) {
743 // => signed Int32Add/Sub 743 // => signed Int32Add/Sub
744 VisitInt32Binop(node); 744 VisitInt32Binop(node);
745 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); 745 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
746 } else if (CanLowerToUint32Binop(node, use)) {
747 // => unsigned Int32Add/Sub
748 VisitUint32Binop(node);
749 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node));
750 } else if (CanLowerToWord32AdditiveBinop(node, use)) {
751 // => signed Int32Add/Sub, truncating inputs
752 ProcessTruncateWord32Input(node, 0);
753 ProcessTruncateWord32Input(node, 1);
754 SetOutput(node, kMachInt32);
755 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
756 } else { 746 } else {
757 // => Float64Add/Sub 747 // => Float64Add/Sub
758 VisitFloat64Binop(node); 748 VisitFloat64Binop(node);
759 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); 749 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
760 } 750 }
761 break; 751 break;
762 } 752 }
763 case IrOpcode::kNumberMultiply: { 753 case IrOpcode::kNumberMultiply: {
764 NumberMatcher right(node->InputAt(1)); 754 NumberMatcher right(node->InputAt(1));
765 if (right.IsInRange(-1048576, 1048576)) { // must fit double mantissa. 755 if (right.IsInRange(-1048576, 1048576)) { // must fit double mantissa.
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 ReplaceEffectUses(node, comparison); 1659 ReplaceEffectUses(node, comparison);
1670 node->ReplaceInput(0, comparison); 1660 node->ReplaceInput(0, comparison);
1671 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1661 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1672 node->TrimInputCount(2); 1662 node->TrimInputCount(2);
1673 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); 1663 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual());
1674 } 1664 }
1675 1665
1676 } // namespace compiler 1666 } // namespace compiler
1677 } // namespace internal 1667 } // namespace internal
1678 } // namespace v8 1668 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698