Commit a04467f9 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Sanitize the Truncation query method names.

Use better names for the query methods on the Truncation class, that
express more clearly what you intend to query.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2171703002
Cr-Commit-Position: refs/heads/master@{#37935}
parent 4b59bf53
...@@ -278,7 +278,7 @@ Node* RepresentationChanger::GetFloat32RepresentationFor( ...@@ -278,7 +278,7 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
node = jsgraph()->graph()->NewNode(op, node); node = jsgraph()->graph()->NewNode(op, node);
op = machine()->TruncateFloat64ToFloat32(); op = machine()->TruncateFloat64ToFloat32();
} else if (output_type->Is(Type::Unsigned32()) || } else if (output_type->Is(Type::Unsigned32()) ||
truncation.TruncatesToWord32()) { truncation.IsUsedAsWord32()) {
// Either the output is uint32 or the uses only care about the // Either the output is uint32 or the uses only care about the
// low 32 bits (so we can pick uint32 safely). // low 32 bits (so we can pick uint32 safely).
...@@ -340,7 +340,7 @@ Node* RepresentationChanger::GetFloat64RepresentationFor( ...@@ -340,7 +340,7 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
if (output_type->Is(Type::Signed32())) { if (output_type->Is(Type::Signed32())) {
op = machine()->ChangeInt32ToFloat64(); op = machine()->ChangeInt32ToFloat64();
} else if (output_type->Is(Type::Unsigned32()) || } else if (output_type->Is(Type::Unsigned32()) ||
use_info.truncation().TruncatesToWord32()) { use_info.truncation().IsUsedAsWord32()) {
// Either the output is uint32 or the uses only care about the // Either the output is uint32 or the uses only care about the
// low 32 bits (so we can pick uint32 safely). // low 32 bits (so we can pick uint32 safely).
op = machine()->ChangeUint32ToFloat64(); op = machine()->ChangeUint32ToFloat64();
...@@ -415,7 +415,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor( ...@@ -415,7 +415,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
op = machine()->ChangeFloat64ToUint32(); op = machine()->ChangeFloat64ToUint32();
} else if (output_type->Is(Type::Signed32())) { } else if (output_type->Is(Type::Signed32())) {
op = machine()->ChangeFloat64ToInt32(); op = machine()->ChangeFloat64ToInt32();
} else if (use_info.truncation().TruncatesToWord32()) { } else if (use_info.truncation().IsUsedAsWord32()) {
op = machine()->TruncateFloat64ToWord32(); op = machine()->TruncateFloat64ToWord32();
} else if (use_info.type_check() == TypeCheckKind::kSigned32) { } else if (use_info.type_check() == TypeCheckKind::kSigned32) {
op = simplified()->CheckedFloat64ToInt32(); op = simplified()->CheckedFloat64ToInt32();
...@@ -426,7 +426,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor( ...@@ -426,7 +426,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
op = machine()->ChangeFloat64ToUint32(); op = machine()->ChangeFloat64ToUint32();
} else if (output_type->Is(Type::Signed32())) { } else if (output_type->Is(Type::Signed32())) {
op = machine()->ChangeFloat64ToInt32(); op = machine()->ChangeFloat64ToInt32();
} else if (use_info.truncation().TruncatesToWord32()) { } else if (use_info.truncation().IsUsedAsWord32()) {
op = machine()->TruncateFloat64ToWord32(); op = machine()->TruncateFloat64ToWord32();
} else if (use_info.type_check() == TypeCheckKind::kSigned32) { } else if (use_info.type_check() == TypeCheckKind::kSigned32) {
op = simplified()->CheckedFloat64ToInt32(); op = simplified()->CheckedFloat64ToInt32();
...@@ -438,7 +438,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor( ...@@ -438,7 +438,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
op = simplified()->ChangeTaggedToUint32(); op = simplified()->ChangeTaggedToUint32();
} else if (output_type->Is(Type::Signed32())) { } else if (output_type->Is(Type::Signed32())) {
op = simplified()->ChangeTaggedToInt32(); op = simplified()->ChangeTaggedToInt32();
} else if (use_info.truncation().TruncatesToWord32()) { } else if (use_info.truncation().IsUsedAsWord32()) {
op = simplified()->TruncateTaggedToWord32(); op = simplified()->TruncateTaggedToWord32();
} else if (use_info.type_check() == TypeCheckKind::kSigned32) { } else if (use_info.type_check() == TypeCheckKind::kSigned32) {
op = simplified()->CheckedTaggedToInt32(); op = simplified()->CheckedTaggedToInt32();
...@@ -543,7 +543,7 @@ Node* RepresentationChanger::GetCheckedWord32RepresentationFor( ...@@ -543,7 +543,7 @@ Node* RepresentationChanger::GetCheckedWord32RepresentationFor(
op = machine()->ChangeFloat64ToUint32(); op = machine()->ChangeFloat64ToUint32();
} else if (output_type->Is(Type::Signed32())) { } else if (output_type->Is(Type::Signed32())) {
op = machine()->ChangeFloat64ToInt32(); op = machine()->ChangeFloat64ToInt32();
} else if (truncation.TruncatesToWord32()) { } else if (truncation.IsUsedAsWord32()) {
op = machine()->TruncateFloat64ToWord32(); op = machine()->TruncateFloat64ToWord32();
} else if (check == TypeCheckKind::kSigned32) { } else if (check == TypeCheckKind::kSigned32) {
op = simplified()->CheckedFloat64ToInt32(); op = simplified()->CheckedFloat64ToInt32();
...@@ -554,7 +554,7 @@ Node* RepresentationChanger::GetCheckedWord32RepresentationFor( ...@@ -554,7 +554,7 @@ Node* RepresentationChanger::GetCheckedWord32RepresentationFor(
op = machine()->ChangeFloat64ToUint32(); op = machine()->ChangeFloat64ToUint32();
} else if (output_type->Is(Type::Signed32())) { } else if (output_type->Is(Type::Signed32())) {
op = machine()->ChangeFloat64ToInt32(); op = machine()->ChangeFloat64ToInt32();
} else if (truncation.TruncatesToWord32()) { } else if (truncation.IsUsedAsWord32()) {
op = machine()->TruncateFloat64ToWord32(); op = machine()->TruncateFloat64ToWord32();
} else if (check == TypeCheckKind::kSigned32) { } else if (check == TypeCheckKind::kSigned32) {
op = simplified()->CheckedFloat64ToInt32(); op = simplified()->CheckedFloat64ToInt32();
...@@ -566,7 +566,7 @@ Node* RepresentationChanger::GetCheckedWord32RepresentationFor( ...@@ -566,7 +566,7 @@ Node* RepresentationChanger::GetCheckedWord32RepresentationFor(
op = simplified()->ChangeTaggedToUint32(); op = simplified()->ChangeTaggedToUint32();
} else if (output_type->Is(Type::Signed32())) { } else if (output_type->Is(Type::Signed32())) {
op = simplified()->ChangeTaggedToInt32(); op = simplified()->ChangeTaggedToInt32();
} else if (truncation.TruncatesToWord32()) { } else if (truncation.IsUsedAsWord32()) {
op = simplified()->TruncateTaggedToWord32(); op = simplified()->TruncateTaggedToWord32();
} else if (check == TypeCheckKind::kSigned32) { } else if (check == TypeCheckKind::kSigned32) {
op = simplified()->CheckedTaggedToInt32(); op = simplified()->CheckedTaggedToInt32();
......
...@@ -29,17 +29,17 @@ class Truncation final { ...@@ -29,17 +29,17 @@ class Truncation final {
// Queries. // Queries.
bool IsUnused() const { return kind_ == TruncationKind::kNone; } bool IsUnused() const { return kind_ == TruncationKind::kNone; }
bool TruncatesToWord32() const { bool IsUsedAsWord32() const {
return LessGeneral(kind_, TruncationKind::kWord32); return LessGeneral(kind_, TruncationKind::kWord32);
} }
bool TruncatesToFloat64() const { bool IsUsedAsFloat64() const {
return LessGeneral(kind_, TruncationKind::kFloat64); return LessGeneral(kind_, TruncationKind::kFloat64);
} }
bool TruncatesNaNToZero() { bool IdentifiesNaNAndZero() {
return LessGeneral(kind_, TruncationKind::kWord32) || return LessGeneral(kind_, TruncationKind::kWord32) ||
LessGeneral(kind_, TruncationKind::kBool); LessGeneral(kind_, TruncationKind::kBool);
} }
bool TruncatesUndefinedToZeroOrNaN() { bool IdentifiesUndefinedAndNaNAndZero() {
return LessGeneral(kind_, TruncationKind::kFloat64) || return LessGeneral(kind_, TruncationKind::kFloat64) ||
LessGeneral(kind_, TruncationKind::kWord64); LessGeneral(kind_, TruncationKind::kWord64);
} }
......
This diff is collapsed.
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