Commit 933286fa authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[ptr-compr][codegen] Combine load and Any decompression when possible

Similar to https://chromium-review.googlesource.com/c/v8/v8/+/1697246 but
for the Any case.

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: I99f839faad17da35adac8a084289b1553530d4a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1698394Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62677}
parent d410df56
......@@ -1646,7 +1646,17 @@ void InstructionSelector::VisitChangeTaggedSignedToCompressedSigned(
void InstructionSelector::VisitChangeCompressedToTagged(Node* node) {
Arm64OperandGenerator g(this);
Node* const value = node->InputAt(0);
Emit(kArm64DecompressAny, g.DefineAsRegister(node), g.UseRegister(value));
if (value->opcode() == IrOpcode::kLoad && CanCover(node, value)) {
// TODO(v8:7703): Make this work with poisoned loads as well.
DCHECK_EQ(LoadRepresentationOf(value->op()).representation(),
MachineRepresentation::kCompressed);
InstructionCode opcode = kArm64LdrDecompressAnyTagged;
ImmediateMode immediate_mode = kLoadStoreImm32;
MachineRepresentation rep = MachineRepresentation::kCompressed;
EmitLoad(this, value, opcode, immediate_mode, rep, node);
} else {
Emit(kArm64DecompressAny, g.DefineAsRegister(node), g.UseRegister(value));
}
}
void InstructionSelector::VisitChangeCompressedPointerToTaggedPointer(
......
......@@ -1257,7 +1257,20 @@ void InstructionSelector::VisitChangeTaggedSignedToCompressedSigned(
void InstructionSelector::VisitChangeCompressedToTagged(Node* node) {
X64OperandGenerator g(this);
Node* const value = node->InputAt(0);
Emit(kX64DecompressAny, g.DefineAsRegister(node), g.Use(value));
if (value->opcode() == IrOpcode::kLoad && CanCover(node, value)) {
DCHECK_EQ(LoadRepresentationOf(value->op()).representation(),
MachineRepresentation::kCompressed);
InstructionCode opcode = kX64MovqDecompressAnyTagged;
InstructionOperand outputs[] = {g.DefineAsRegister(node)};
size_t input_count = 0;
InstructionOperand inputs[3];
AddressingMode mode = g.GetEffectiveAddressMemoryOperand(
node->InputAt(0), inputs, &input_count);
opcode |= AddressingModeField::encode(mode);
Emit(opcode, 1, outputs, input_count, inputs);
} else {
Emit(kX64DecompressAny, g.DefineAsRegister(node), g.Use(value));
}
}
void InstructionSelector::VisitChangeCompressedPointerToTaggedPointer(
......
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