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

Unified Diff: src/compiler/representation-change.cc

Issue 2750803002: [turbofan] Add more error reporting to representation changer. (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/representation-change.cc
diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc
index eca5650ba597ef06c2870b9ee21a98e850a6b431..ee56f0b52d2d327acb06cb19c7fc27479513b22c 100644
--- a/src/compiler/representation-change.cc
+++ b/src/compiler/representation-change.cc
@@ -307,12 +307,16 @@ Node* RepresentationChanger::GetTaggedSignedRepresentationFor(
return TypeError(node, output_rep, output_type,
MachineRepresentation::kTaggedSigned);
}
- } else if (output_rep == MachineRepresentation::kBit &&
- use_info.type_check() == TypeCheckKind::kSignedSmall) {
- // TODO(turbofan): Consider adding a Bailout operator that just deopts.
- // Also use that for MachineRepresentation::kPointer case above.
- node = InsertChangeBitToTagged(node);
- op = simplified()->CheckedTaggedToTaggedSigned();
+ } else if (output_rep == MachineRepresentation::kBit) {
+ if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
+ // TODO(turbofan): Consider adding a Bailout operator that just deopts.
+ // Also use that for MachineRepresentation::kPointer case above.
+ node = InsertChangeBitToTagged(node);
+ op = simplified()->CheckedTaggedToTaggedSigned();
+ } else {
+ return TypeError(node, output_rep, output_type,
+ MachineRepresentation::kTaggedSigned);
+ }
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kTaggedSigned);
@@ -633,6 +637,9 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
op = machine()->ChangeFloat64ToUint32();
} else if (use_info.truncation().IsUsedAsWord32()) {
op = machine()->TruncateFloat64ToWord32();
+ } else {
+ return TypeError(node, output_rep, output_type,
+ MachineRepresentation::kWord32);
}
} else if (output_rep == MachineRepresentation::kFloat32) {
node = InsertChangeFloat32ToFloat64(node); // float32 -> float64 -> int32
@@ -648,6 +655,9 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
op = machine()->ChangeFloat64ToUint32();
} else if (use_info.truncation().IsUsedAsWord32()) {
op = machine()->TruncateFloat64ToWord32();
+ } else {
+ return TypeError(node, output_rep, output_type,
+ MachineRepresentation::kWord32);
}
} else if (output_rep == MachineRepresentation::kTaggedSigned) {
if (output_type->Is(Type::Signed32())) {
@@ -658,6 +668,9 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
} else {
op = simplified()->TruncateTaggedToWord32();
}
+ } else {
+ return TypeError(node, output_rep, output_type,
+ MachineRepresentation::kWord32);
}
} else if (output_rep == MachineRepresentation::kTagged ||
output_rep == MachineRepresentation::kTaggedPointer) {
@@ -677,7 +690,13 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
op = simplified()->TruncateTaggedToWord32();
} else if (use_info.type_check() != TypeCheckKind::kNone) {
op = simplified()->CheckedTruncateTaggedToWord32();
+ } else {
+ return TypeError(node, output_rep, output_type,
+ MachineRepresentation::kWord32);
}
+ } else {
+ return TypeError(node, output_rep, output_type,
+ MachineRepresentation::kWord32);
}
} else if (output_rep == MachineRepresentation::kWord32) {
// Only the checked case should get here, the non-checked case is
@@ -688,6 +707,9 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
return node;
} else if (output_type->Is(Type::Unsigned32())) {
op = simplified()->CheckedUint32ToInt32();
+ } else {
+ return TypeError(node, output_rep, output_type,
+ MachineRepresentation::kWord32);
}
} else {
DCHECK_EQ(TypeCheckKind::kNumberOrOddball, use_info.type_check());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698