| 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/address-map.h" | 9 #include "src/address-map.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return MachineRepresentation::kWord32; | 80 return MachineRepresentation::kWord32; |
| 81 case kExternalFloat32Array: | 81 case kExternalFloat32Array: |
| 82 return MachineRepresentation::kFloat32; | 82 return MachineRepresentation::kFloat32; |
| 83 case kExternalFloat64Array: | 83 case kExternalFloat64Array: |
| 84 return MachineRepresentation::kFloat64; | 84 return MachineRepresentation::kFloat64; |
| 85 } | 85 } |
| 86 UNREACHABLE(); | 86 UNREACHABLE(); |
| 87 return MachineRepresentation::kNone; | 87 return MachineRepresentation::kNone; |
| 88 } | 88 } |
| 89 | 89 |
| 90 UseInfo CheckedUseInfoAsWord32FromHint(NumberOperationHint hint) { | 90 UseInfo CheckedUseInfoAsWord32FromHint( |
| 91 NumberOperationHint hint, CheckForMinusZeroMode minus_zero_mode = |
| 92 CheckForMinusZeroMode::kCheckForMinusZero) { |
| 91 switch (hint) { | 93 switch (hint) { |
| 92 case NumberOperationHint::kSignedSmall: | 94 case NumberOperationHint::kSignedSmall: |
| 93 return UseInfo::CheckedSignedSmallAsWord32(); | 95 return UseInfo::CheckedSignedSmallAsWord32(minus_zero_mode); |
| 94 case NumberOperationHint::kSigned32: | 96 case NumberOperationHint::kSigned32: |
| 95 return UseInfo::CheckedSigned32AsWord32(); | 97 return UseInfo::CheckedSigned32AsWord32(minus_zero_mode); |
| 96 case NumberOperationHint::kNumber: | 98 case NumberOperationHint::kNumber: |
| 97 return UseInfo::CheckedNumberAsWord32(); | 99 return UseInfo::CheckedNumberAsWord32(); |
| 98 case NumberOperationHint::kNumberOrOddball: | 100 case NumberOperationHint::kNumberOrOddball: |
| 99 return UseInfo::CheckedNumberOrOddballAsWord32(); | 101 return UseInfo::CheckedNumberOrOddballAsWord32(); |
| 100 } | 102 } |
| 101 UNREACHABLE(); | 103 UNREACHABLE(); |
| 102 return UseInfo::None(); | 104 return UseInfo::None(); |
| 103 } | 105 } |
| 104 | 106 |
| 105 UseInfo CheckedUseInfoAsFloat64FromHint(NumberOperationHint hint) { | 107 UseInfo CheckedUseInfoAsFloat64FromHint(NumberOperationHint hint) { |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 hint == NumberOperationHint::kSigned32) { | 1141 hint == NumberOperationHint::kSigned32) { |
| 1140 VisitBinop(node, UseInfo::TruncatingWord32(), | 1142 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1141 MachineRepresentation::kWord32, Type::Signed32()); | 1143 MachineRepresentation::kWord32, Type::Signed32()); |
| 1142 if (lower()) ChangeToInt32OverflowOp(node); | 1144 if (lower()) ChangeToInt32OverflowOp(node); |
| 1143 return; | 1145 return; |
| 1144 } | 1146 } |
| 1145 } | 1147 } |
| 1146 | 1148 |
| 1147 if (hint == NumberOperationHint::kSignedSmall || | 1149 if (hint == NumberOperationHint::kSignedSmall || |
| 1148 hint == NumberOperationHint::kSigned32) { | 1150 hint == NumberOperationHint::kSigned32) { |
| 1149 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1151 UseInfo left_use = CheckedUseInfoAsWord32FromHint(hint); |
| 1150 MachineRepresentation::kWord32, Type::Signed32()); | 1152 // For subtraction, the right hand side can be minus zero without |
| 1153 // resulting in minus zero, so we skip the check for it. |
| 1154 UseInfo right_use = CheckedUseInfoAsWord32FromHint( |
| 1155 hint, node->opcode() == IrOpcode::kSpeculativeNumberSubtract |
| 1156 ? CheckForMinusZeroMode::kDontCheckForMinusZero |
| 1157 : CheckForMinusZeroMode::kCheckForMinusZero); |
| 1158 VisitBinop(node, left_use, right_use, MachineRepresentation::kWord32, |
| 1159 Type::Signed32()); |
| 1151 if (lower()) ChangeToInt32OverflowOp(node); | 1160 if (lower()) ChangeToInt32OverflowOp(node); |
| 1152 return; | 1161 return; |
| 1153 } | 1162 } |
| 1154 | 1163 |
| 1155 // default case => Float64Add/Sub | 1164 // default case => Float64Add/Sub |
| 1156 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), | 1165 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), |
| 1157 MachineRepresentation::kFloat64, Type::Number()); | 1166 MachineRepresentation::kFloat64, Type::Number()); |
| 1158 if (lower()) { | 1167 if (lower()) { |
| 1159 ChangeToPureOp(node, Float64Op(node)); | 1168 ChangeToPureOp(node, Float64Op(node)); |
| 1160 } | 1169 } |
| (...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3241 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3250 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3242 Operator::kNoProperties); | 3251 Operator::kNoProperties); |
| 3243 to_number_operator_.set(common()->Call(desc)); | 3252 to_number_operator_.set(common()->Call(desc)); |
| 3244 } | 3253 } |
| 3245 return to_number_operator_.get(); | 3254 return to_number_operator_.get(); |
| 3246 } | 3255 } |
| 3247 | 3256 |
| 3248 } // namespace compiler | 3257 } // namespace compiler |
| 3249 } // namespace internal | 3258 } // namespace internal |
| 3250 } // namespace v8 | 3259 } // namespace v8 |
| OLD | NEW |