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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2848583002: [turbofan] Fix impossible type handling for TypeGuard and BooleanNot. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/access-builder.cc ('k') | test/mjsunit/compiler/regress-715204.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index f0fdb931a849cd6812dbeeb0958bbd4613224b9d..a71054977ce5e61c3446072b1e45f97934a5cff6 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1531,11 +1531,14 @@ class RepresentationSelector {
// BooleanNot(x: kRepBit) => Word32Equal(x, #0)
node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0));
NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal());
- } else {
- DCHECK(CanBeTaggedPointer(input_info->representation()));
+ } else if (CanBeTaggedPointer(input_info->representation())) {
// BooleanNot(x: kRepTagged) => WordEqual(x, #false)
node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant());
NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
+ } else {
+ DCHECK_EQ(MachineRepresentation::kNone,
+ input_info->representation());
+ DeferReplacement(node, lowering->jsgraph()->Int32Constant(0));
}
} else {
// No input representation requirement; adapt during lowering.
@@ -2779,9 +2782,15 @@ class RepresentationSelector {
// We just get rid of the sigma here. In principle, it should be
// possible to refine the truncation and representation based on
// the sigma's type.
- MachineRepresentation output =
+ MachineRepresentation representation =
GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation);
- VisitUnop(node, UseInfo(output, truncation), output);
+
+ // For now, we just handle specially the impossible case.
+ MachineRepresentation output = TypeOf(node)->IsInhabited()
+ ? representation
+ : MachineRepresentation::kNone;
+
+ VisitUnop(node, UseInfo(representation, truncation), output);
if (lower()) DeferReplacement(node, node->InputAt(0));
return;
}
« no previous file with comments | « src/compiler/access-builder.cc ('k') | test/mjsunit/compiler/regress-715204.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698