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/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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); | 941 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); |
942 } else { | 942 } else { |
943 // => Float64Cmp | 943 // => Float64Cmp |
944 VisitFloat64Cmp(node); | 944 VisitFloat64Cmp(node); |
945 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 945 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
946 } | 946 } |
947 break; | 947 break; |
948 } | 948 } |
949 case IrOpcode::kNumberAdd: | 949 case IrOpcode::kNumberAdd: |
950 case IrOpcode::kNumberSubtract: { | 950 case IrOpcode::kNumberSubtract: { |
951 // Add and subtract reduce to Int32Add/Sub if the inputs | 951 if (BothInputsAre(node, Type::Signed32()) && |
952 // are safe integers and all uses are truncating. | 952 NodeProperties::GetType(node)->Is(Type::Signed32())) { |
953 if (BothInputsAre(node, type_cache_.kAdditiveSafeInteger) && | 953 // int32 + int32 = int32 |
954 truncation.TruncatesToWord32()) { | |
955 // => signed Int32Add/Sub | 954 // => signed Int32Add/Sub |
| 955 VisitInt32Binop(node); |
| 956 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
| 957 } else if (BothInputsAre(node, type_cache_.kAdditiveSafeInteger) && |
| 958 truncation.TruncatesToWord32()) { |
| 959 // safe-int + safe-int = x (truncated to int32) |
| 960 // => signed Int32Add/Sub (truncated) |
956 VisitWord32TruncatingBinop(node); | 961 VisitWord32TruncatingBinop(node); |
957 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); | 962 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
958 } else { | 963 } else { |
959 // => Float64Add/Sub | 964 // => Float64Add/Sub |
960 VisitFloat64Binop(node); | 965 VisitFloat64Binop(node); |
961 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 966 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
962 } | 967 } |
963 break; | 968 break; |
964 } | 969 } |
965 case IrOpcode::kNumberMultiply: { | 970 case IrOpcode::kNumberMultiply: { |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 ReplaceEffectUses(node, comparison); | 1926 ReplaceEffectUses(node, comparison); |
1922 node->ReplaceInput(0, comparison); | 1927 node->ReplaceInput(0, comparison); |
1923 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1928 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1924 node->TrimInputCount(2); | 1929 node->TrimInputCount(2); |
1925 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); | 1930 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); |
1926 } | 1931 } |
1927 | 1932 |
1928 } // namespace compiler | 1933 } // namespace compiler |
1929 } // namespace internal | 1934 } // namespace internal |
1930 } // namespace v8 | 1935 } // namespace v8 |
OLD | NEW |