[ptr-compr] Specialize CompressedSigned -> Word32 conversion

This CL aims to address the regressions that we saw in Octane 2.1,
particularly in the DeltaBlue test.

This CL brings a 5% improvement in said test by doing
CompressedSigned -> Word32 conversion (instead of
CompressedSigned -> TaggedSigned -> Word32).

There seems to be room for optimizations doing more specialized conversions
regarding representation changes.

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: I24e5b6c06436fdda9fa6a1ac4699dc55c3d67abd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1684075
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62557}
This commit is contained in:
Santiago Aboy Solanes 2019-07-08 10:54:29 +01:00 committed by Commit Bot
parent af4905d391
commit bda32bcbd0
7 changed files with 29 additions and 5 deletions

View File

@ -58,6 +58,7 @@ class EffectControlLinearizer {
Node* LowerChangeUint64ToTagged(Node* node); Node* LowerChangeUint64ToTagged(Node* node);
Node* LowerChangeFloat64ToTagged(Node* node); Node* LowerChangeFloat64ToTagged(Node* node);
Node* LowerChangeFloat64ToTaggedPointer(Node* node); Node* LowerChangeFloat64ToTaggedPointer(Node* node);
Node* LowerChangeCompressedSignedToInt32(Node* node);
Node* LowerChangeTaggedSignedToInt32(Node* node); Node* LowerChangeTaggedSignedToInt32(Node* node);
Node* LowerChangeTaggedSignedToInt64(Node* node); Node* LowerChangeTaggedSignedToInt64(Node* node);
Node* LowerChangeTaggedToBit(Node* node); Node* LowerChangeTaggedToBit(Node* node);
@ -228,6 +229,7 @@ class EffectControlLinearizer {
Node* ChangeUint32ToUintPtr(Node* value); Node* ChangeUint32ToUintPtr(Node* value);
Node* ChangeUint32ToSmi(Node* value); Node* ChangeUint32ToSmi(Node* value);
Node* ChangeSmiToIntPtr(Node* value); Node* ChangeSmiToIntPtr(Node* value);
Node* ChangeCompressedSmiToInt32(Node* value);
Node* ChangeSmiToInt32(Node* value); Node* ChangeSmiToInt32(Node* value);
Node* ChangeSmiToInt64(Node* value); Node* ChangeSmiToInt64(Node* value);
Node* ObjectIsSmi(Node* value); Node* ObjectIsSmi(Node* value);
@ -854,6 +856,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kChangeFloat64ToTaggedPointer: case IrOpcode::kChangeFloat64ToTaggedPointer:
result = LowerChangeFloat64ToTaggedPointer(node); result = LowerChangeFloat64ToTaggedPointer(node);
break; break;
case IrOpcode::kChangeCompressedSignedToInt32:
result = LowerChangeCompressedSignedToInt32(node);
break;
case IrOpcode::kChangeTaggedSignedToInt32: case IrOpcode::kChangeTaggedSignedToInt32:
result = LowerChangeTaggedSignedToInt32(node); result = LowerChangeTaggedSignedToInt32(node);
break; break;
@ -1485,6 +1490,11 @@ Node* EffectControlLinearizer::LowerChangeTaggedSignedToInt32(Node* node) {
return ChangeSmiToInt32(value); return ChangeSmiToInt32(value);
} }
Node* EffectControlLinearizer::LowerChangeCompressedSignedToInt32(Node* node) {
Node* value = node->InputAt(0);
return ChangeCompressedSmiToInt32(value);
}
Node* EffectControlLinearizer::LowerChangeTaggedSignedToInt64(Node* node) { Node* EffectControlLinearizer::LowerChangeTaggedSignedToInt64(Node* node) {
Node* value = node->InputAt(0); Node* value = node->InputAt(0);
return ChangeSmiToInt64(value); return ChangeSmiToInt64(value);
@ -4459,6 +4469,11 @@ Node* EffectControlLinearizer::ChangeSmiToInt32(Node* value) {
return ChangeSmiToIntPtr(value); return ChangeSmiToIntPtr(value);
} }
Node* EffectControlLinearizer::ChangeCompressedSmiToInt32(Node* value) {
CHECK(machine()->Is64() && SmiValuesAre31Bits());
return __ Word32Sar(value, SmiShiftBitsConstant());
}
Node* EffectControlLinearizer::ChangeSmiToInt64(Node* value) { Node* EffectControlLinearizer::ChangeSmiToInt64(Node* value) {
CHECK(machine()->Is64()); CHECK(machine()->Is64());
return ChangeSmiToIntPtr(value); return ChangeSmiToIntPtr(value);

View File

@ -232,6 +232,7 @@
// Opcodes for VirtuaMachine-level operators. // Opcodes for VirtuaMachine-level operators.
#define SIMPLIFIED_CHANGE_OP_LIST(V) \ #define SIMPLIFIED_CHANGE_OP_LIST(V) \
V(ChangeCompressedSignedToInt32) \
V(ChangeTaggedSignedToInt32) \ V(ChangeTaggedSignedToInt32) \
V(ChangeTaggedSignedToInt64) \ V(ChangeTaggedSignedToInt64) \
V(ChangeTaggedToInt32) \ V(ChangeTaggedToInt32) \

View File

@ -1089,11 +1089,15 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
output_type, use_node, use_info); output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kCompressedSigned) { } else if (output_rep == MachineRepresentation::kCompressedSigned) {
// TODO(v8:8977): Specialise here // TODO(v8:8977): Specialise here
if (output_type.Is(Type::SignedSmall())) {
op = simplified()->ChangeCompressedSignedToInt32();
} else {
op = machine()->ChangeCompressedSignedToTaggedSigned(); op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node); node = jsgraph()->graph()->NewNode(op, node);
return GetWord32RepresentationFor(node, return GetWord32RepresentationFor(node,
MachineRepresentation::kTaggedSigned, MachineRepresentation::kTaggedSigned,
output_type, use_node, use_info); output_type, use_node, use_info);
}
} else if (output_rep == MachineRepresentation::kCompressedPointer) { } else if (output_rep == MachineRepresentation::kCompressedPointer) {
// TODO(v8:8977): Specialise here // TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedPointerToTaggedPointer(); op = machine()->ChangeCompressedPointerToTaggedPointer();

View File

@ -720,6 +720,7 @@ bool operator==(CheckMinusZeroParameters const& lhs,
V(PlainPrimitiveToNumber, Operator::kNoProperties, 1, 0) \ V(PlainPrimitiveToNumber, Operator::kNoProperties, 1, 0) \
V(PlainPrimitiveToWord32, Operator::kNoProperties, 1, 0) \ V(PlainPrimitiveToWord32, Operator::kNoProperties, 1, 0) \
V(PlainPrimitiveToFloat64, Operator::kNoProperties, 1, 0) \ V(PlainPrimitiveToFloat64, Operator::kNoProperties, 1, 0) \
V(ChangeCompressedSignedToInt32, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1, 0) \ V(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedSignedToInt64, Operator::kNoProperties, 1, 0) \ V(ChangeTaggedSignedToInt64, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToInt32, Operator::kNoProperties, 1, 0) \ V(ChangeTaggedToInt32, Operator::kNoProperties, 1, 0) \

View File

@ -695,6 +695,7 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const Operator* PlainPrimitiveToWord32(); const Operator* PlainPrimitiveToWord32();
const Operator* PlainPrimitiveToFloat64(); const Operator* PlainPrimitiveToFloat64();
const Operator* ChangeCompressedSignedToInt32();
const Operator* ChangeTaggedSignedToInt32(); const Operator* ChangeTaggedSignedToInt32();
const Operator* ChangeTaggedSignedToInt64(); const Operator* ChangeTaggedSignedToInt64();
const Operator* ChangeTaggedToInt32(); const Operator* ChangeTaggedToInt32();

View File

@ -1320,6 +1320,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckNotTyped(node); CheckNotTyped(node);
break; break;
case IrOpcode::kChangeCompressedSignedToInt32:
case IrOpcode::kChangeTaggedSignedToInt32: { case IrOpcode::kChangeTaggedSignedToInt32: {
// Signed32 /\ Tagged -> Signed32 /\ UntaggedInt32 // Signed32 /\ Tagged -> Signed32 /\ UntaggedInt32
// TODO(neis): Activate once ChangeRepresentation works in typer. // TODO(neis): Activate once ChangeRepresentation works in typer.

View File

@ -53,6 +53,7 @@ const PureOperator kPureOperators[] = {
PURE(NumberShiftRightLogical, Operator::kNoProperties, 2), PURE(NumberShiftRightLogical, Operator::kNoProperties, 2),
PURE(NumberToInt32, Operator::kNoProperties, 1), PURE(NumberToInt32, Operator::kNoProperties, 1),
PURE(NumberToUint32, Operator::kNoProperties, 1), PURE(NumberToUint32, Operator::kNoProperties, 1),
PURE(ChangeCompressedSignedToInt32, Operator::kNoProperties, 1),
PURE(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1), PURE(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1),
PURE(ChangeTaggedToInt32, Operator::kNoProperties, 1), PURE(ChangeTaggedToInt32, Operator::kNoProperties, 1),
PURE(ChangeTaggedToUint32, Operator::kNoProperties, 1), PURE(ChangeTaggedToUint32, Operator::kNoProperties, 1),