Commit a262b544 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbofan] Thread feedback through simplified lowering

Simplified lowering may loose feedback by inserting Checked
conversions for BoundsChecks in case the bounds check gets
optimized away later on.

Bug: v8:7127
Change-Id: I254a29ba4e578d653d1dee2d70582ce0a4b57789
Reviewed-on: https://chromium-review.googlesource.com/878743Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50783}
parent 7b0e02bc
......@@ -203,9 +203,11 @@ class UseInfo {
Truncation::Any(identify_zeros), TypeCheckKind::kSignedSmall,
feedback);
}
static UseInfo CheckedSigned32AsWord32(IdentifyZeros identify_zeros) {
static UseInfo CheckedSigned32AsWord32(IdentifyZeros identify_zeros,
const VectorSlotPair& feedback) {
return UseInfo(MachineRepresentation::kWord32,
Truncation::Any(identify_zeros), TypeCheckKind::kSigned32);
Truncation::Any(identify_zeros), TypeCheckKind::kSigned32,
feedback);
}
static UseInfo CheckedNumberAsFloat64() {
return UseInfo(MachineRepresentation::kFloat64, Truncation::Any(),
......
......@@ -95,7 +95,7 @@ UseInfo CheckedUseInfoAsWord32FromHint(
return UseInfo::CheckedSignedSmallAsWord32(identify_zeros,
VectorSlotPair());
case NumberOperationHint::kSigned32:
return UseInfo::CheckedSigned32AsWord32(identify_zeros);
return UseInfo::CheckedSigned32AsWord32(identify_zeros, VectorSlotPair());
case NumberOperationHint::kNumber:
return UseInfo::CheckedNumberAsWord32();
case NumberOperationHint::kNumberOrOddball:
......@@ -2405,6 +2405,7 @@ class RepresentationSelector {
return;
}
case IrOpcode::kCheckBounds: {
const CheckParameters& p = CheckParametersOf(node->op());
Type* index_type = TypeOf(node->InputAt(0));
Type* length_type = TypeOf(node->InputAt(1));
if (index_type->Is(Type::Integral32OrMinusZero())) {
......@@ -2423,9 +2424,10 @@ class RepresentationSelector {
}
}
} else {
VisitBinop(node, UseInfo::CheckedSigned32AsWord32(kIdentifyZeros),
UseInfo::TruncatingWord32(),
MachineRepresentation::kWord32);
VisitBinop(
node,
UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, p.feedback()),
UseInfo::TruncatingWord32(), MachineRepresentation::kWord32);
}
return;
}
......
......@@ -452,11 +452,13 @@ static void TestMinusZeroCheck(IrOpcode::Value expected, Type* from_type) {
expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSignedSmallAsWord32(kIdentifyZeros, VectorSlotPair()));
CheckChange(expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros));
CheckChange(
expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros, VectorSlotPair()));
CheckChange(expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros));
CheckChange(
expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros, VectorSlotPair()));
}
TEST(MinusZeroCheck) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment