Commit 25aab0f3 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

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

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

The three CLs combined bring good improvements to the code generation,
both in code size and then in runtime.

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: I0903df55f3e19d3ee4dddb3c069ddc27b3265cd3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1698395Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62678}
parent 933286fa
......@@ -1663,7 +1663,17 @@ void InstructionSelector::VisitChangeCompressedPointerToTaggedPointer(
Node* node) {
Arm64OperandGenerator g(this);
Node* const value = node->InputAt(0);
Emit(kArm64DecompressPointer, g.DefineAsRegister(node), g.UseRegister(value));
if (value->opcode() == IrOpcode::kLoad && CanCover(node, value)) {
DCHECK_EQ(LoadRepresentationOf(value->op()).representation(),
MachineRepresentation::kCompressedPointer);
InstructionCode opcode = kArm64LdrDecompressTaggedPointer;
ImmediateMode immediate_mode = kLoadStoreImm32;
MachineRepresentation rep = MachineRepresentation::kCompressedPointer;
EmitLoad(this, value, opcode, immediate_mode, rep, node);
} else {
Emit(kArm64DecompressPointer, g.DefineAsRegister(node),
g.UseRegister(value));
}
}
void InstructionSelector::VisitChangeCompressedSignedToTaggedSigned(
......
......@@ -1277,7 +1277,20 @@ void InstructionSelector::VisitChangeCompressedPointerToTaggedPointer(
Node* node) {
X64OperandGenerator g(this);
Node* const value = node->InputAt(0);
Emit(kX64DecompressPointer, g.DefineAsRegister(node), g.Use(value));
if (value->opcode() == IrOpcode::kLoad && CanCover(node, value)) {
DCHECK_EQ(LoadRepresentationOf(value->op()).representation(),
MachineRepresentation::kCompressedPointer);
InstructionCode opcode = kX64MovqDecompressTaggedPointer;
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(kX64DecompressPointer, g.DefineAsRegister(node), g.Use(value));
}
}
void InstructionSelector::VisitChangeCompressedSignedToTaggedSigned(
......
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