Commit 53f6e02a authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[ptr-compr][turbofan][cleanup] Make use of InsertChange functions

We weren't fully using InsertChangeCompressedToTagged and similar, which
in turn made it so that we were using more NewNode. This CL unifies the
way that we generate the insertion of Change nodes regarding decompressions.

Dribe-by fix: make InsertChangeCompressedPointerToTaggedPointer actually
use Pointer.

Bug: v8:7703
Change-Id: I1d8835a54914cdab93f652ff17e39e8271a585df
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1741661Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63154}
parent b597d6fa
......@@ -864,20 +864,17 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedToTagged();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedToTagged(node);
return GetFloat32RepresentationFor(node, MachineRepresentation::kTagged,
output_type, truncation);
} else if (output_rep == MachineRepresentation::kCompressedSigned) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedSignedToTaggedSigned(node);
return GetFloat32RepresentationFor(
node, MachineRepresentation::kTaggedSigned, output_type, truncation);
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedPointerToTaggedPointer();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedPointerToTaggedPointer(node);
return GetFloat32RepresentationFor(
node, MachineRepresentation::kTaggedPointer, output_type, truncation);
} else if (output_rep == MachineRepresentation::kFloat64) {
......@@ -982,21 +979,18 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedToTagged();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedToTagged(node);
return GetFloat64RepresentationFor(node, MachineRepresentation::kTagged,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kCompressedSigned) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedSignedToTaggedSigned(node);
return GetFloat64RepresentationFor(node,
MachineRepresentation::kTaggedSigned,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedPointerToTaggedPointer();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedPointerToTaggedPointer(node);
return GetFloat64RepresentationFor(node,
MachineRepresentation::kTaggedPointer,
output_type, use_node, use_info);
......@@ -1150,8 +1144,7 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedToTagged();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedToTagged(node);
return GetWord32RepresentationFor(node, MachineRepresentation::kTagged,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kCompressedSigned) {
......@@ -1159,16 +1152,14 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
if (output_type.Is(Type::SignedSmall())) {
op = simplified()->ChangeCompressedSignedToInt32();
} else {
op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedSignedToTaggedSigned(node);
return GetWord32RepresentationFor(node,
MachineRepresentation::kTaggedSigned,
output_type, use_node, use_info);
}
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedPointerToTaggedPointer();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedPointerToTaggedPointer(node);
return GetWord32RepresentationFor(node,
MachineRepresentation::kTaggedPointer,
output_type, use_node, use_info);
......@@ -1287,20 +1278,17 @@ Node* RepresentationChanger::GetBitRepresentationFor(
jsgraph()->Int32Constant(0));
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedToTagged();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedToTagged(node);
return GetBitRepresentationFor(node, MachineRepresentation::kTagged,
output_type);
} else if (output_rep == MachineRepresentation::kCompressedSigned) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedSignedToTaggedSigned(node);
return GetBitRepresentationFor(node, MachineRepresentation::kTaggedSigned,
output_type);
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedPointerToTaggedPointer();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedPointerToTaggedPointer(node);
return GetBitRepresentationFor(node, MachineRepresentation::kTaggedPointer,
output_type);
} else if (IsWord(output_rep)) {
......@@ -1457,21 +1445,18 @@ Node* RepresentationChanger::GetWord64RepresentationFor(
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedToTagged();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedToTagged(node);
return GetWord64RepresentationFor(node, MachineRepresentation::kTagged,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kCompressedSigned) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedSignedToTaggedSigned(node);
return GetWord64RepresentationFor(node,
MachineRepresentation::kTaggedSigned,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedPointerToTaggedPointer();
node = jsgraph()->graph()->NewNode(op, node);
node = InsertChangeCompressedPointerToTaggedPointer(node);
return GetWord64RepresentationFor(node,
MachineRepresentation::kTaggedPointer,
output_type, use_node, use_info);
......@@ -1777,8 +1762,14 @@ Node* RepresentationChanger::InsertTruncateInt64ToInt32(Node* node) {
Node* RepresentationChanger::InsertChangeCompressedPointerToTaggedPointer(
Node* node) {
return jsgraph()->graph()->NewNode(machine()->ChangeCompressedToTagged(),
node);
return jsgraph()->graph()->NewNode(
machine()->ChangeCompressedPointerToTaggedPointer(), node);
}
Node* RepresentationChanger::InsertChangeCompressedSignedToTaggedSigned(
Node* node) {
return jsgraph()->graph()->NewNode(
machine()->ChangeCompressedSignedToTaggedSigned(), node);
}
Node* RepresentationChanger::InsertChangeCompressedToTagged(Node* node) {
......
......@@ -396,6 +396,7 @@ class V8_EXPORT_PRIVATE RepresentationChanger final {
Node* InsertChangeTaggedToFloat64(Node* node);
Node* InsertChangeUint32ToFloat64(Node* node);
Node* InsertChangeCompressedPointerToTaggedPointer(Node* node);
Node* InsertChangeCompressedSignedToTaggedSigned(Node* node);
Node* InsertChangeCompressedToTagged(Node* node);
Node* InsertCheckedFloat64ToInt32(Node* node, CheckForMinusZeroMode check,
const VectorSlotPair& feedback,
......
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