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

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

Issue 2154073002: [Turbofan]: Eliminate the check for -0 if it's not possible/observable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code comments. Created 4 years, 5 months 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 | « src/compiler/representation-change.cc ('k') | src/compiler/simplified-operator.h » ('j') | 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/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 return WriteBarrierKindFor(base_taggedness, field_representation, 1070 return WriteBarrierKindFor(base_taggedness, field_representation,
1071 field_type, value); 1071 field_type, value);
1072 } 1072 }
1073 1073
1074 Graph* graph() const { return jsgraph_->graph(); } 1074 Graph* graph() const { return jsgraph_->graph(); }
1075 CommonOperatorBuilder* common() const { return jsgraph_->common(); } 1075 CommonOperatorBuilder* common() const { return jsgraph_->common(); }
1076 SimplifiedOperatorBuilder* simplified() const { 1076 SimplifiedOperatorBuilder* simplified() const {
1077 return jsgraph_->simplified(); 1077 return jsgraph_->simplified();
1078 } 1078 }
1079 1079
1080 void LowerToCheckedInt32MulWithOverflowOp(Node* node, Truncation truncation,
Benedikt Meurer 2016/07/18 08:55:38 Nit: Just LowerToCheckedInt32Mul.
1081 Type* input0_type,
1082 Type* input1_type) {
1083 // If one of the inputs is positive and/or truncation is being applied,
1084 // there is no need to return -0.
1085 CheckForMinusZeroMode mz_mode =
1086 truncation.TruncatesToWord32() ||
1087 (input0_type->Is(Type::OrderedNumber()) &&
1088 input0_type->Min() > 0) ||
1089 (input1_type->Is(Type::OrderedNumber()) &&
1090 input1_type->Min() > 0)
1091 ? CheckForMinusZeroMode::kDontCheckForMinusZero
1092 : CheckForMinusZeroMode::kCheckForMinusZero;
1093
1094 NodeProperties::ChangeOp(node, simplified()->CheckedInt32Mul(mz_mode));
1095 }
1096
1080 void ChangeToInt32OverflowOp(Node* node) { 1097 void ChangeToInt32OverflowOp(Node* node) {
1081 NodeProperties::ChangeOp(node, Int32OverflowOp(node)); 1098 NodeProperties::ChangeOp(node, Int32OverflowOp(node));
1082 } 1099 }
1083 1100
1084 void ChangeToUint32OverflowOp(Node* node) { 1101 void ChangeToUint32OverflowOp(Node* node) {
1085 NodeProperties::ChangeOp(node, Uint32OverflowOp(node)); 1102 NodeProperties::ChangeOp(node, Uint32OverflowOp(node));
1086 } 1103 }
1087 1104
1088 void VisitSpeculativeAdditiveOp(Node* node, Truncation truncation, 1105 void VisitSpeculativeAdditiveOp(Node* node, Truncation truncation,
1089 SimplifiedLowering* lowering) { 1106 SimplifiedLowering* lowering) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 // (a) the output is either known to be Signed32, or 1343 // (a) the output is either known to be Signed32, or
1327 // (b) the output is known to be Unsigned32, or 1344 // (b) the output is known to be Unsigned32, or
1328 // (c) the uses are truncating and the result is in the safe 1345 // (c) the uses are truncating and the result is in the safe
1329 // integer range. 1346 // integer range.
1330 VisitWord32TruncatingBinop(node); 1347 VisitWord32TruncatingBinop(node);
1331 if (lower()) ChangeToPureOp(node, Int32Op(node)); 1348 if (lower()) ChangeToPureOp(node, Int32Op(node));
1332 return; 1349 return;
1333 } 1350 }
1334 // Try to use type feedback. 1351 // Try to use type feedback.
1335 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); 1352 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1353 Type* input0_type = TypeOf(node->InputAt(0));
1354 Type* input1_type = TypeOf(node->InputAt(1));
1336 1355
1337 // Handle the case when no int32 checks on inputs are necessary 1356 // Handle the case when no int32 checks on inputs are necessary
1338 // (but an overflow check is needed on the output). 1357 // (but an overflow check is needed on the output).
1339 if (BothInputsAre(node, Type::Signed32())) { 1358 if (BothInputsAre(node, Type::Signed32())) {
1340 // If both the inputs the feedback are int32, use the overflow op. 1359 // If both the inputs the feedback are int32, use the overflow op.
1341 if (hint == BinaryOperationHints::kSignedSmall || 1360 if (hint == BinaryOperationHints::kSignedSmall ||
1342 hint == BinaryOperationHints::kSigned32) { 1361 hint == BinaryOperationHints::kSigned32) {
1343 VisitBinop(node, UseInfo::TruncatingWord32(), 1362 VisitBinop(node, UseInfo::TruncatingWord32(),
1344 MachineRepresentation::kWord32, Type::Signed32()); 1363 MachineRepresentation::kWord32, Type::Signed32());
1345 if (lower()) ChangeToInt32OverflowOp(node); 1364 if (lower()) {
1365 LowerToCheckedInt32MulWithOverflowOp(node, truncation,
1366 input0_type, input1_type);
1367 }
1346 return; 1368 return;
1347 } 1369 }
1348 } 1370 }
1349 1371
1350 if (hint == BinaryOperationHints::kSignedSmall || 1372 if (hint == BinaryOperationHints::kSignedSmall ||
1351 hint == BinaryOperationHints::kSigned32) { 1373 hint == BinaryOperationHints::kSigned32) {
1352 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), 1374 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
1353 MachineRepresentation::kWord32, Type::Signed32()); 1375 MachineRepresentation::kWord32, Type::Signed32());
1354 if (lower()) ChangeToInt32OverflowOp(node); 1376 if (lower()) {
1377 LowerToCheckedInt32MulWithOverflowOp(node, truncation, input0_type,
1378 input1_type);
1379 }
1355 return; 1380 return;
1356 } 1381 }
1357 1382
1358 // Checked float64 x float64 => float64 1383 // Checked float64 x float64 => float64
1359 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), 1384 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(),
1360 MachineRepresentation::kFloat64, Type::Number()); 1385 MachineRepresentation::kFloat64, Type::Number());
1361 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1386 if (lower()) ChangeToPureOp(node, Float64Op(node));
1362 return; 1387 return;
1363 } 1388 }
1364 case IrOpcode::kNumberMultiply: { 1389 case IrOpcode::kNumberMultiply: {
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
3346 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3371 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3347 Operator::kNoProperties); 3372 Operator::kNoProperties);
3348 to_number_operator_.set(common()->Call(desc)); 3373 to_number_operator_.set(common()->Call(desc));
3349 } 3374 }
3350 return to_number_operator_.get(); 3375 return to_number_operator_.get();
3351 } 3376 }
3352 3377
3353 } // namespace compiler 3378 } // namespace compiler
3354 } // namespace internal 3379 } // namespace internal
3355 } // namespace v8 3380 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698