Commit c99fda19 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[ptr-compr] Add the Float -> CompressedSigned cases that are free

Some of the Float(32|64) to CompressedSigned cases had their functions
defined already so they are virtually free to implement.

We are still missing the unsigned case so I am keeping the TODO.

Cq-Include-Trybots: luci.v8.try:v8_linux64_pointer_compression_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_arm64_pointer_compression_rel_ng
Bug: v8:7703
Change-Id: Ibf40d5948226fd48aebe7f8e257c117d6a5ad478
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1708483Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63143}
parent 9281508c
......@@ -316,12 +316,12 @@ Node* RepresentationChanger::GetTaggedSignedRepresentationFor(
node = InsertChangeFloat64ToUint32(node);
op = simplified()->CheckedUint32ToTaggedSigned(use_info.feedback());
} else if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
op = simplified()->CheckedFloat64ToInt32(
node = InsertCheckedFloat64ToInt32(
node,
output_type.Maybe(Type::MinusZero())
? CheckForMinusZeroMode::kCheckForMinusZero
: CheckForMinusZeroMode::kDontCheckForMinusZero,
use_info.feedback());
node = InsertConversion(node, op, use_node);
use_info.feedback(), use_node);
if (SmiValuesAre32Bits()) {
op = simplified()->ChangeInt32ToTagged();
} else {
......@@ -333,14 +333,13 @@ Node* RepresentationChanger::GetTaggedSignedRepresentationFor(
}
} else if (output_rep == MachineRepresentation::kFloat32) {
if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
op = machine()->ChangeFloat32ToFloat64();
node = InsertConversion(node, op, use_node);
op = simplified()->CheckedFloat64ToInt32(
node = InsertChangeFloat32ToFloat64(node);
node = InsertCheckedFloat64ToInt32(
node,
output_type.Maybe(Type::MinusZero())
? CheckForMinusZeroMode::kCheckForMinusZero
: CheckForMinusZeroMode::kDontCheckForMinusZero,
use_info.feedback());
node = InsertConversion(node, op, use_node);
use_info.feedback(), use_node);
if (SmiValuesAre32Bits()) {
op = simplified()->ChangeInt32ToTagged();
} else {
......@@ -671,13 +670,48 @@ Node* RepresentationChanger::GetCompressedSignedRepresentationFor(
use_node, use_info);
op = machine()->ChangeTaggedSignedToCompressedSigned();
} else if (output_rep == MachineRepresentation::kFloat32) {
node = GetTaggedSignedRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedSignedToCompressedSigned();
// float 32 -> float64 -> int32 -> Compressed signed
if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
node = InsertChangeFloat32ToFloat64(node);
node = InsertCheckedFloat64ToInt32(
node,
output_type.Maybe(Type::MinusZero())
? CheckForMinusZeroMode::kCheckForMinusZero
: CheckForMinusZeroMode::kDontCheckForMinusZero,
use_info.feedback(), use_node);
op = simplified()->CheckedInt32ToCompressedSigned(use_info.feedback());
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kCompressedSigned);
}
} else if (output_rep == MachineRepresentation::kFloat64) {
node = GetTaggedSignedRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedSignedToCompressedSigned();
if (output_type.Is(Type::Signed31())) {
// float64 -> int32 -> compressed signed
node = InsertChangeFloat64ToInt32(node);
op = simplified()->ChangeInt31ToCompressedSigned();
} else if (output_type.Is(Type::Signed32())) {
// float64 -> int32 -> compressed signed
node = InsertChangeFloat64ToInt32(node);
if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
op = simplified()->CheckedInt32ToCompressedSigned(use_info.feedback());
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kCompressedSigned);
}
} else if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
node = InsertCheckedFloat64ToInt32(
node,
output_type.Maybe(Type::MinusZero())
? CheckForMinusZeroMode::kCheckForMinusZero
: CheckForMinusZeroMode::kDontCheckForMinusZero,
use_info.feedback(), use_node);
op = simplified()->CheckedInt32ToCompressedSigned(use_info.feedback());
} else {
// TODO(v8:8977): specialize here and below. Missing the unsigned case.
node = GetTaggedSignedRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedSignedToCompressedSigned();
}
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kCompressedSigned);
......@@ -1752,6 +1786,13 @@ Node* RepresentationChanger::InsertChangeCompressedToTagged(Node* node) {
node);
}
Node* RepresentationChanger::InsertCheckedFloat64ToInt32(
Node* node, CheckForMinusZeroMode check, const VectorSlotPair& feedback,
Node* use_node) {
return InsertConversion(
node, simplified()->CheckedFloat64ToInt32(check, feedback), use_node);
}
Isolate* RepresentationChanger::isolate() const { return broker_->isolate(); }
} // namespace compiler
......
......@@ -397,6 +397,9 @@ class V8_EXPORT_PRIVATE RepresentationChanger final {
Node* InsertChangeUint32ToFloat64(Node* node);
Node* InsertChangeCompressedPointerToTaggedPointer(Node* node);
Node* InsertChangeCompressedToTagged(Node* node);
Node* InsertCheckedFloat64ToInt32(Node* node, CheckForMinusZeroMode check,
const VectorSlotPair& feedback,
Node* use_node);
Node* InsertConversion(Node* node, const Operator* op, Node* use_node);
Node* InsertTruncateInt64ToInt32(Node* node);
Node* InsertUnconditionalDeopt(Node* node, DeoptimizeReason reason);
......
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