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

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

Issue 2836203004: [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 | « no previous file | 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..11c10469b739809107f67e39878ecf7429dfff03 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,8 +2782,13 @@ 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.
+
+ // For now, we just handle specially the impossible case.
MachineRepresentation output =
- GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation);
+ TypeOf(node)->IsInhabited()
+ ? GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)),
+ truncation)
+ : MachineRepresentation::kNone;
VisitUnop(node, UseInfo(output, truncation), output);
if (lower()) DeferReplacement(node, node->InputAt(0));
return;
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-715204.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698