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

[Turbofan][ptr-compr] Change native context specialisation for CompressedPointer

This CL adds the representation changes from/to CompressedPointer to the other
data types (excluding Tagged, which was done in a previous CL).

Also adding missing write barriers for compressed values (WriteBarrierKindFor).

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:8977, v8:7703
Change-Id: Ieb4e6dd72371e858ba1da551f765e42581a51f90
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1571616Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60924}
parent c8763dd1
......@@ -337,7 +337,11 @@ PropertyAccessInfo AccessInfoFactory::ComputeDataFieldAccessInfo(
} else if (details_representation.IsHeapObject()) {
// Extract the field type from the property details (make sure its
// representation is TaggedPointer to reflect the heap object case).
#ifdef V8_COMPRESS_POINTERS
field_representation = MachineRepresentation::kCompressedPointer;
#else
field_representation = MachineRepresentation::kTaggedPointer;
#endif
Handle<FieldType> descriptors_field_type(descriptors->GetFieldType(number),
isolate());
if (descriptors_field_type->IsNone()) {
......
......@@ -298,7 +298,9 @@ Node* PropertyAccessBuilder::BuildLoadDataField(
field_access.offset = HeapNumber::kValueOffset;
field_access.name = MaybeHandle<Name>();
}
} else if (field_representation == MachineRepresentation::kTaggedPointer) {
} else if (field_representation == MachineRepresentation::kTaggedPointer ||
field_representation ==
MachineRepresentation::kCompressedPointer) {
// Remember the map of the field value, if its map is stable. This is
// used by the LoadElimination to eliminate map checks on the result.
Handle<Map> field_map;
......
......@@ -355,7 +355,7 @@ Node* RepresentationChanger::GetTaggedSignedRepresentationFor(
}
} else if (output_rep == MachineRepresentation::kCompressedSigned) {
op = machine()->ChangeCompressedSignedToTaggedSigned();
} else if (output_rep == MachineRepresentation::kCompressed) {
} else if (CanBeCompressedPointer(output_rep)) {
if (use_info.type_check() == TypeCheckKind::kSignedSmall) {
op = simplified()->CheckedCompressedToTaggedSigned(use_info.feedback());
} else if (output_type.Is(Type::SignedSmall())) {
......@@ -449,7 +449,7 @@ Node* RepresentationChanger::GetTaggedPointerRepresentationFor(
op = simplified()->CheckedTaggedToTaggedPointer(use_info.feedback());
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
op = machine()->ChangeCompressedPointerToTaggedPointer();
} else if (output_rep == MachineRepresentation::kCompressed &&
} else if (CanBeCompressedSigned(output_rep) &&
use_info.type_check() == TypeCheckKind::kHeapObject) {
if (!output_type.Maybe(Type::SignedSmall())) {
return node;
......@@ -652,6 +652,30 @@ Node* RepresentationChanger::GetCompressedPointerRepresentationFor(
op = simplified()->CheckedTaggedToCompressedPointer(use_info.feedback());
return TypeError(node, output_rep, output_type,
MachineRepresentation::kCompressedPointer);
} else if (output_rep == MachineRepresentation::kBit) {
// TODO(v8:8977): specialize here and below
node = GetTaggedPointerRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedPointerToCompressedPointer();
} else if (IsWord(output_rep)) {
node = GetTaggedPointerRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedPointerToCompressedPointer();
} else if (output_rep == MachineRepresentation::kWord64) {
node = GetTaggedPointerRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedPointerToCompressedPointer();
} else if (output_rep == MachineRepresentation::kFloat32) {
node = GetTaggedPointerRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedPointerToCompressedPointer();
} else if (output_rep == MachineRepresentation::kFloat64) {
node = GetTaggedPointerRepresentationFor(node, output_rep, output_type,
use_node, use_info);
op = machine()->ChangeTaggedPointerToCompressedPointer();
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kCompressedPointer);
}
return InsertConversion(node, op, use_node);
}
......@@ -762,6 +786,12 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
node = jsgraph()->graph()->NewNode(op, 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);
return GetFloat32RepresentationFor(
node, MachineRepresentation::kTaggedPointer, output_type, truncation);
} else if (output_rep == MachineRepresentation::kFloat64) {
op = machine()->TruncateFloat64ToFloat32();
} else if (output_rep == MachineRepresentation::kWord64) {
......@@ -862,6 +892,13 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
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);
return GetFloat64RepresentationFor(node,
MachineRepresentation::kTaggedPointer,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kFloat32) {
op = machine()->ChangeFloat32ToFloat64();
} else if (output_rep == MachineRepresentation::kWord64) {
......@@ -1023,6 +1060,13 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
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);
return GetWord32RepresentationFor(node,
MachineRepresentation::kTaggedPointer,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kWord32) {
// Only the checked case should get here, the non-checked case is
// handled in GetRepresentationFor.
......@@ -1148,6 +1192,12 @@ Node* RepresentationChanger::GetBitRepresentationFor(
node = jsgraph()->graph()->NewNode(op, 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);
return GetBitRepresentationFor(node, MachineRepresentation::kTaggedPointer,
output_type);
} else if (IsWord(output_rep)) {
node = jsgraph()->graph()->NewNode(machine()->Word32Equal(), node,
jsgraph()->Int32Constant(0));
......@@ -1291,6 +1341,13 @@ Node* RepresentationChanger::GetWord64RepresentationFor(
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);
return GetWord64RepresentationFor(node,
MachineRepresentation::kTaggedPointer,
output_type, use_node, use_info);
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord64);
......
......@@ -1233,10 +1233,12 @@ class RepresentationSelector {
MachineRepresentation field_representation, Type field_type,
MachineRepresentation value_representation, Node* value) {
if (base_taggedness == kTaggedBase &&
CanBeTaggedPointer(field_representation)) {
CanBeTaggedOrCompressedPointer(field_representation)) {
Type value_type = NodeProperties::GetType(value);
if (field_representation == MachineRepresentation::kTaggedSigned ||
value_representation == MachineRepresentation::kTaggedSigned) {
value_representation == MachineRepresentation::kTaggedSigned ||
field_representation == MachineRepresentation::kCompressedSigned ||
value_representation == MachineRepresentation::kCompressedSigned) {
// Write barriers are only for stores of heap objects.
return kNoWriteBarrier;
}
......@@ -1258,7 +1260,9 @@ class RepresentationSelector {
}
}
if (field_representation == MachineRepresentation::kTaggedPointer ||
value_representation == MachineRepresentation::kTaggedPointer) {
value_representation == MachineRepresentation::kTaggedPointer ||
field_representation == MachineRepresentation::kCompressedPointer ||
value_representation == MachineRepresentation::kCompressedPointer) {
// Write barriers for heap objects are cheaper.
return kPointerWriteBarrier;
}
......
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