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( ...@@ -317,7 +317,12 @@ bool AccessInfoFactory::ComputeDataFieldAccessInfo(
FieldIndex field_index = FieldIndex field_index =
FieldIndex::ForPropertyIndex(*map, index, details_representation); FieldIndex::ForPropertyIndex(*map, index, details_representation);
Type field_type = Type::NonInternal(); Type field_type = Type::NonInternal();
#ifdef V8_COMPRESS_POINTERS
MachineRepresentation field_representation =
MachineRepresentation::kCompressed;
#else
MachineRepresentation field_representation = MachineRepresentation::kTagged; MachineRepresentation field_representation = MachineRepresentation::kTagged;
#endif
MaybeHandle<Map> field_map; MaybeHandle<Map> field_map;
MapRef map_ref(broker(), map); MapRef map_ref(broker(), map);
if (details_representation.IsSmi()) { if (details_representation.IsSmi()) {
......
...@@ -2332,6 +2332,9 @@ JSNativeContextSpecialization::BuildPropertyStore( ...@@ -2332,6 +2332,9 @@ JSNativeContextSpecialization::BuildPropertyStore(
case MachineRepresentation::kTaggedSigned: case MachineRepresentation::kTaggedSigned:
case MachineRepresentation::kTaggedPointer: case MachineRepresentation::kTaggedPointer:
case MachineRepresentation::kTagged: case MachineRepresentation::kTagged:
case MachineRepresentation::kCompressedSigned:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
if (store_to_constant_field) { if (store_to_constant_field) {
DCHECK(!access_info.HasTransitionMap()); DCHECK(!access_info.HasTransitionMap());
// If the field is constant check that the value we are going // If the field is constant check that the value we are going
...@@ -2347,13 +2350,16 @@ JSNativeContextSpecialization::BuildPropertyStore( ...@@ -2347,13 +2350,16 @@ JSNativeContextSpecialization::BuildPropertyStore(
return ValueEffectControl(value, effect, control); return ValueEffectControl(value, effect, control);
} }
if (field_representation == MachineRepresentation::kTaggedSigned) { if (field_representation == MachineRepresentation::kTaggedSigned ||
field_representation == MachineRepresentation::kCompressedSigned) {
value = effect = graph()->NewNode( value = effect = graph()->NewNode(
simplified()->CheckSmi(VectorSlotPair()), value, effect, control); simplified()->CheckSmi(VectorSlotPair()), value, effect, control);
field_access.write_barrier_kind = kNoWriteBarrier; field_access.write_barrier_kind = kNoWriteBarrier;
} else if (field_representation == } else if (field_representation ==
MachineRepresentation::kTaggedPointer) { MachineRepresentation::kTaggedPointer ||
field_representation ==
MachineRepresentation::kCompressedPointer) {
// Ensure that {value} is a HeapObject. // Ensure that {value} is a HeapObject.
value = access_builder.BuildCheckHeapObject(value, &effect, control); value = access_builder.BuildCheckHeapObject(value, &effect, control);
Handle<Map> field_map; Handle<Map> field_map;
...@@ -2367,7 +2373,8 @@ JSNativeContextSpecialization::BuildPropertyStore( ...@@ -2367,7 +2373,8 @@ JSNativeContextSpecialization::BuildPropertyStore(
field_access.write_barrier_kind = kPointerWriteBarrier; field_access.write_barrier_kind = kPointerWriteBarrier;
} else { } else {
DCHECK_EQ(MachineRepresentation::kTagged, field_representation); DCHECK(field_representation == MachineRepresentation::kTagged ||
field_representation == MachineRepresentation::kCompressed);
} }
break; break;
case MachineRepresentation::kNone: case MachineRepresentation::kNone:
...@@ -2378,10 +2385,6 @@ JSNativeContextSpecialization::BuildPropertyStore( ...@@ -2378,10 +2385,6 @@ JSNativeContextSpecialization::BuildPropertyStore(
case MachineRepresentation::kWord64: case MachineRepresentation::kWord64:
case MachineRepresentation::kFloat32: case MachineRepresentation::kFloat32:
case MachineRepresentation::kSimd128: case MachineRepresentation::kSimd128:
// TODO(solanes): Create the code for the compressed values
case MachineRepresentation::kCompressedSigned:
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
UNREACHABLE(); UNREACHABLE();
break; break;
} }
......
...@@ -650,6 +650,27 @@ Node* RepresentationChanger::GetCompressedRepresentationFor( ...@@ -650,6 +650,27 @@ Node* RepresentationChanger::GetCompressedRepresentationFor(
return jsgraph()->graph()->NewNode( return jsgraph()->graph()->NewNode(
jsgraph()->common()->DeadValue(MachineRepresentation::kCompressed), jsgraph()->common()->DeadValue(MachineRepresentation::kCompressed),
node); 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)) { } else if (IsAnyTagged(output_rep)) {
op = machine()->ChangeTaggedToCompressed(); op = machine()->ChangeTaggedToCompressed();
} else { } else {
...@@ -708,6 +729,13 @@ Node* RepresentationChanger::GetFloat32RepresentationFor( ...@@ -708,6 +729,13 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
node = jsgraph()->graph()->NewNode(op, node); node = jsgraph()->graph()->NewNode(op, node);
op = machine()->TruncateFloat64ToFloat32(); 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) { } else if (output_rep == MachineRepresentation::kFloat64) {
op = machine()->TruncateFloat64ToFloat32(); op = machine()->TruncateFloat64ToFloat32();
} else if (output_rep == MachineRepresentation::kWord64) { } else if (output_rep == MachineRepresentation::kWord64) {
...@@ -795,6 +823,13 @@ Node* RepresentationChanger::GetFloat64RepresentationFor( ...@@ -795,6 +823,13 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
op = simplified()->CheckedTaggedToFloat64( op = simplified()->CheckedTaggedToFloat64(
CheckTaggedInputMode::kNumberOrOddball, use_info.feedback()); 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) { } else if (output_rep == MachineRepresentation::kFloat32) {
op = machine()->ChangeFloat32ToFloat64(); op = machine()->ChangeFloat32ToFloat64();
} else if (output_rep == MachineRepresentation::kWord64) { } else if (output_rep == MachineRepresentation::kWord64) {
...@@ -943,6 +978,13 @@ Node* RepresentationChanger::GetWord32RepresentationFor( ...@@ -943,6 +978,13 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
return TypeError(node, output_rep, output_type, return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord32); 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) { } else if (output_rep == MachineRepresentation::kWord32) {
// Only the checked case should get here, the non-checked case is // Only the checked case should get here, the non-checked case is
// handled in GetRepresentationFor. // handled in GetRepresentationFor.
...@@ -1056,6 +1098,12 @@ Node* RepresentationChanger::GetBitRepresentationFor( ...@@ -1056,6 +1098,12 @@ Node* RepresentationChanger::GetBitRepresentationFor(
jsgraph()->IntPtrConstant(0)); jsgraph()->IntPtrConstant(0));
return jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, return jsgraph()->graph()->NewNode(machine()->Word32Equal(), node,
jsgraph()->Int32Constant(0)); 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)) { } else if (IsWord(output_rep)) {
node = jsgraph()->graph()->NewNode(machine()->Word32Equal(), node, node = jsgraph()->graph()->NewNode(machine()->Word32Equal(), node,
jsgraph()->Int32Constant(0)); jsgraph()->Int32Constant(0));
...@@ -1186,6 +1234,13 @@ Node* RepresentationChanger::GetWord64RepresentationFor( ...@@ -1186,6 +1234,13 @@ Node* RepresentationChanger::GetWord64RepresentationFor(
return TypeError(node, output_rep, output_type, return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord64); 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 { } else {
return TypeError(node, output_rep, output_type, return TypeError(node, output_rep, output_type,
MachineRepresentation::kWord64); MachineRepresentation::kWord64);
......
...@@ -186,6 +186,16 @@ class UseInfo { ...@@ -186,6 +186,16 @@ class UseInfo {
static UseInfo TaggedPointer() { static UseInfo TaggedPointer() {
return UseInfo(MachineRepresentation::kTaggedPointer, Truncation::Any()); 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. // Possibly deoptimizing conversions.
static UseInfo CheckedHeapObjectAsTaggedPointer( static UseInfo CheckedHeapObjectAsTaggedPointer(
......
...@@ -132,6 +132,11 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { ...@@ -132,6 +132,11 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) {
case MachineRepresentation::kTaggedPointer: case MachineRepresentation::kTaggedPointer:
case MachineRepresentation::kTagged: case MachineRepresentation::kTagged:
return UseInfo::AnyTagged(); return UseInfo::AnyTagged();
case MachineRepresentation::kCompressedSigned:
return UseInfo::CompressedSigned();
case MachineRepresentation::kCompressedPointer:
case MachineRepresentation::kCompressed:
return UseInfo::AnyCompressed();
case MachineRepresentation::kFloat64: case MachineRepresentation::kFloat64:
return UseInfo::TruncatingFloat64(); return UseInfo::TruncatingFloat64();
case MachineRepresentation::kFloat32: case MachineRepresentation::kFloat32:
...@@ -144,10 +149,6 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { ...@@ -144,10 +149,6 @@ UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) {
return UseInfo::Word64(); return UseInfo::Word64();
case MachineRepresentation::kBit: case MachineRepresentation::kBit:
return UseInfo::Bool(); 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::kSimd128:
case MachineRepresentation::kNone: case MachineRepresentation::kNone:
break; 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