Commit 20a93efe authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[Turbofan][ptr-compr] Change native context specialisation for Compressed (Any)

This CL can be used as a base for specialising CompressedSigned and
CompressedPointer.

B

Cq-Include-Trybots: luci.v8.try:v8_linux64_pointer_compression_rel_ng,v8_linux64_arm64_pointer_compression_rel_ng
Bug: v8:8977, v8:7703
Change-Id: I43c8e7f57021ac506822aba5bbd4bdf6cc3159ba
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1543731
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60827}
parent 549031b4
......@@ -317,7 +317,12 @@ bool AccessInfoFactory::ComputeDataFieldAccessInfo(
FieldIndex field_index =
FieldIndex::ForPropertyIndex(*map, index, details_representation);
Type field_type = Type::NonInternal();
#ifdef V8_COMPRESS_POINTERS
MachineRepresentation field_representation =
MachineRepresentation::kCompressed;
#else
MachineRepresentation field_representation = MachineRepresentation::kTagged;
#endif
MaybeHandle<Map> field_map;
MapRef map_ref(broker(), map);
if (details_representation.IsSmi()) {
......
......@@ -2332,6 +2332,9 @@ JSNativeContextSpecialization::BuildPropertyStore(
case MachineRepresentation::kTaggedSigned:
case MachineRepresentation::kTaggedPointer:
case MachineRepresentation::kTagged:
case MachineRepresentation::kCompressedSigned:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
if (store_to_constant_field) {
DCHECK(!access_info.HasTransitionMap());
// If the field is constant check that the value we are going
......@@ -2347,13 +2350,16 @@ JSNativeContextSpecialization::BuildPropertyStore(
return ValueEffectControl(value, effect, control);
}
if (field_representation == MachineRepresentation::kTaggedSigned) {
if (field_representation == MachineRepresentation::kTaggedSigned ||
field_representation == MachineRepresentation::kCompressedSigned) {
value = effect = graph()->NewNode(
simplified()->CheckSmi(VectorSlotPair()), value, effect, control);
field_access.write_barrier_kind = kNoWriteBarrier;
} else if (field_representation ==
MachineRepresentation::kTaggedPointer) {
MachineRepresentation::kTaggedPointer ||
field_representation ==
MachineRepresentation::kCompressedPointer) {
// Ensure that {value} is a HeapObject.
value = access_builder.BuildCheckHeapObject(value, &effect, control);
Handle<Map> field_map;
......@@ -2367,7 +2373,8 @@ JSNativeContextSpecialization::BuildPropertyStore(
field_access.write_barrier_kind = kPointerWriteBarrier;
} else {
DCHECK_EQ(MachineRepresentation::kTagged, field_representation);
DCHECK(field_representation == MachineRepresentation::kTagged ||
field_representation == MachineRepresentation::kCompressed);
}
break;
case MachineRepresentation::kNone:
......@@ -2378,10 +2385,6 @@ JSNativeContextSpecialization::BuildPropertyStore(
case MachineRepresentation::kWord64:
case MachineRepresentation::kFloat32:
case MachineRepresentation::kSimd128:
// TODO(solanes): Create the code for the compressed values
case MachineRepresentation::kCompressedSigned:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
UNREACHABLE();
break;
}
......
......@@ -650,6 +650,27 @@ Node* RepresentationChanger::GetCompressedRepresentationFor(
return jsgraph()->graph()->NewNode(
jsgraph()->common()->DeadValue(MachineRepresentation::kCompressed),
node);
} else if (output_rep == MachineRepresentation::kBit) {
// TODO(v8:8977): specialize here and below
node =
GetTaggedRepresentationFor(node, output_rep, output_type, truncation);
op = machine()->ChangeTaggedToCompressed();
} else if (IsWord(output_rep)) {
node =
GetTaggedRepresentationFor(node, output_rep, output_type, truncation);
op = machine()->ChangeTaggedToCompressed();
} else if (output_rep == MachineRepresentation::kWord64) {
node =
GetTaggedRepresentationFor(node, output_rep, output_type, truncation);
op = machine()->ChangeTaggedToCompressed();
} else if (output_rep == MachineRepresentation::kFloat32) {
node =
GetTaggedRepresentationFor(node, output_rep, output_type, truncation);
op = machine()->ChangeTaggedToCompressed();
} else if (output_rep == MachineRepresentation::kFloat64) {
node =
GetTaggedRepresentationFor(node, output_rep, output_type, truncation);
op = machine()->ChangeTaggedToCompressed();
} else if (IsAnyTagged(output_rep)) {
op = machine()->ChangeTaggedToCompressed();
} else {
......@@ -708,6 +729,13 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
node = jsgraph()->graph()->NewNode(op, node);
op = machine()->TruncateFloat64ToFloat32();
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
Node* intermediate_node =
GetTaggedRepresentationFor(node, output_rep, output_type, truncation);
return GetFloat32RepresentationFor(intermediate_node,
MachineRepresentation::kTagged,
output_type, truncation);
} else if (output_rep == MachineRepresentation::kFloat64) {
op = machine()->TruncateFloat64ToFloat32();
} else if (output_rep == MachineRepresentation::kWord64) {
......@@ -795,6 +823,13 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
op = simplified()->CheckedTaggedToFloat64(
CheckTaggedInputMode::kNumberOrOddball, use_info.feedback());
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
Node* intermediate_node = GetTaggedRepresentationFor(
node, output_rep, output_type, use_info.truncation());
return GetFloat64RepresentationFor(intermediate_node,
MachineRepresentation::kTagged,
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kFloat32) {
op = machine()->ChangeFloat32ToFloat64();
} else if (output_rep == MachineRepresentation::kWord64) {
......@@ -943,6 +978,13 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord32);
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
Node* intermediate_node = GetTaggedRepresentationFor(
node, output_rep, output_type, use_info.truncation());
return GetWord32RepresentationFor(intermediate_node,
MachineRepresentation::kTagged,
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.
......@@ -1056,6 +1098,12 @@ Node* RepresentationChanger::GetBitRepresentationFor(
jsgraph()->IntPtrConstant(0));
return jsgraph()->graph()->NewNode(machine()->Word32Equal(), node,
jsgraph()->Int32Constant(0));
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
Node* intermediate_node = GetTaggedRepresentationFor(
node, output_rep, output_type, Truncation::Any());
return GetBitRepresentationFor(intermediate_node,
MachineRepresentation::kTagged, output_type);
} else if (IsWord(output_rep)) {
node = jsgraph()->graph()->NewNode(machine()->Word32Equal(), node,
jsgraph()->Int32Constant(0));
......@@ -1186,6 +1234,13 @@ Node* RepresentationChanger::GetWord64RepresentationFor(
return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord64);
}
} else if (output_rep == MachineRepresentation::kCompressed) {
// TODO(v8:8977): Specialise here
Node* intermediate_node = GetTaggedRepresentationFor(
node, output_rep, output_type, use_info.truncation());
return GetWord64RepresentationFor(intermediate_node,
MachineRepresentation::kTagged,
output_type, use_node, use_info);
} else {
return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord64);
......
......@@ -186,6 +186,16 @@ class UseInfo {
static UseInfo TaggedPointer() {
return UseInfo(MachineRepresentation::kTaggedPointer, Truncation::Any());
}
static UseInfo AnyCompressed() {
return UseInfo(MachineRepresentation::kCompressed, Truncation::Any());
}
static UseInfo CompressedSigned() {
return UseInfo(MachineRepresentation::kCompressedSigned, Truncation::Any());
}
static UseInfo CompressedPointer() {
return UseInfo(MachineRepresentation::kCompressedPointer,
Truncation::Any());
}
// Possibly deoptimizing conversions.
static UseInfo CheckedHeapObjectAsTaggedPointer(
......
......@@ -132,6 +132,11 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) {
case MachineRepresentation::kTaggedPointer:
case MachineRepresentation::kTagged:
return UseInfo::AnyTagged();
case MachineRepresentation::kCompressedSigned:
return UseInfo::CompressedSigned();
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
return UseInfo::AnyCompressed();
case MachineRepresentation::kFloat64:
return UseInfo::TruncatingFloat64();
case MachineRepresentation::kFloat32:
......@@ -144,10 +149,6 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) {
return UseInfo::Word64();
case MachineRepresentation::kBit:
return UseInfo::Bool();
// TODO(solanes): Create the code for the compressed values
case MachineRepresentation::kCompressedSigned:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
case MachineRepresentation::kSimd128:
case MachineRepresentation::kNone:
break;
......
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