Commit da8bc4a0 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ptr-compr][cleanup] Remove branchy decompression implementation

... as the smi-corrupting decompression seems to be stable enough.

Bug: v8:9706
Change-Id: I404924ec4a12b37d8bc3e521c5563aa7e6357dc6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1835544Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64107}
parent 616ce253
......@@ -1025,11 +1025,7 @@ void TurboAssembler::SmiUntag(Register dst, const MemOperand& src) {
} else {
DCHECK(SmiValuesAre31Bits());
if (COMPRESS_POINTERS_BOOL) {
if (kUseSmiCorruptingPtrDecompression) {
Ldr(dst.W(), src);
} else {
Ldrsw(dst, src);
}
Ldr(dst.W(), src);
} else {
Ldr(dst, src);
}
......
......@@ -2736,29 +2736,14 @@ void TurboAssembler::DecompressAnyTagged(const Register& destination,
const MemOperand& field_operand) {
RecordComment("[ DecompressAnyTagged");
Ldrsw(destination, field_operand);
if (kUseSmiCorruptingPtrDecompression) {
Add(destination, kRootRegister, destination);
} else {
Label done;
JumpIfSmi(destination, &done);
Add(destination, kRootRegister, destination);
bind(&done);
}
Add(destination, kRootRegister, destination);
RecordComment("]");
}
void TurboAssembler::DecompressAnyTagged(const Register& destination,
const Register& source) {
RecordComment("[ DecompressAnyTagged");
if (kUseSmiCorruptingPtrDecompression) {
Add(destination, kRootRegister, Operand(source, SXTW));
} else {
Label done;
Sxtw(destination, source);
JumpIfSmi(destination, &done);
Add(destination, kRootRegister, destination);
bind(&done);
}
Add(destination, kRootRegister, Operand(source, SXTW));
RecordComment("]");
}
......
......@@ -749,7 +749,7 @@ TNode<Smi> CodeStubAssembler::NormalizeSmiIndex(TNode<Smi> smi_index) {
}
TNode<Smi> CodeStubAssembler::SmiFromInt32(SloppyTNode<Int32T> value) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
static_assert(!COMPRESS_POINTERS_BOOL || (kSmiShiftSize + kSmiTagSize == 1),
"Use shifting instead of add");
return BitcastWordToTaggedSigned(
......@@ -781,7 +781,7 @@ TNode<Smi> CodeStubAssembler::SmiTag(SloppyTNode<IntPtrT> value) {
if (ToInt32Constant(value, &constant_value) && Smi::IsValid(constant_value)) {
return SmiConstant(constant_value);
}
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
return SmiFromInt32(TruncateIntPtrToInt32(value));
}
TNode<Smi> smi =
......@@ -794,7 +794,7 @@ TNode<IntPtrT> CodeStubAssembler::SmiUntag(SloppyTNode<Smi> value) {
if (ToIntPtrConstant(value, &constant_value)) {
return IntPtrConstant(constant_value >> (kSmiShiftSize + kSmiTagSize));
}
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
return ChangeInt32ToIntPtr(SmiToInt32(value));
}
return Signed(WordSar(BitcastTaggedToWordForTagAndSmiBits(value),
......@@ -802,7 +802,7 @@ TNode<IntPtrT> CodeStubAssembler::SmiUntag(SloppyTNode<Smi> value) {
}
TNode<Int32T> CodeStubAssembler::SmiToInt32(SloppyTNode<Smi> value) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
return Signed(Word32Sar(
TruncateIntPtrToInt32(BitcastTaggedToWordForTagAndSmiBits(value)),
SmiShiftBitsConstant32()));
......@@ -9702,11 +9702,7 @@ TNode<IntPtrT> CodeStubAssembler::ElementOffsetFromIndex(
index = smi_index.value();
} else {
if (COMPRESS_POINTERS_BOOL) {
if (kUseSmiCorruptingPtrDecompression) {
smi_index_node = NormalizeSmiIndex(smi_index_node);
} else {
CSA_ASSERT(this, IsValidSmiIndex(smi_index_node));
}
smi_index_node = NormalizeSmiIndex(smi_index_node);
}
}
intptr_index_node = BitcastTaggedToWordForTagAndSmiBits(smi_index_node);
......
......@@ -313,14 +313,7 @@ void TurboAssembler::DecompressTaggedPointer(Register destination,
void TurboAssembler::DecompressRegisterAnyTagged(Register destination,
Register scratch) {
if (kUseSmiCorruptingPtrDecompression) {
addq(destination, kRootRegister);
} else {
Label done;
JumpIfSmi(destination, &done);
addq(destination, kRootRegister);
bind(&done);
}
addq(destination, kRootRegister);
}
void TurboAssembler::DecompressAnyTagged(Register destination,
......
......@@ -246,10 +246,6 @@ using AtomicTagged_t = base::AtomicWord;
#endif // V8_COMPRESS_POINTERS
// Defines whether to use smi-corrupting or branchful implementation of pointer
// decompression should be used.
constexpr bool kUseSmiCorruptingPtrDecompression = true;
STATIC_ASSERT(kTaggedSize == (1 << kTaggedSizeLog2));
STATIC_ASSERT((kTaggedSize == 8) == TAGGED_SIZE_8_BYTES);
......
......@@ -65,12 +65,7 @@ V8_INLINE Address DecompressTaggedPointer(TOnHeapAddress on_heap_addr,
template <typename TOnHeapAddress>
V8_INLINE Address DecompressTaggedAny(TOnHeapAddress on_heap_addr,
Tagged_t raw_value) {
if (kUseSmiCorruptingPtrDecompression) {
return DecompressTaggedPointer(on_heap_addr, raw_value);
}
return HAS_SMI_TAG(raw_value)
? DecompressTaggedSigned(raw_value)
: DecompressTaggedPointer(on_heap_addr, raw_value);
return DecompressTaggedPointer(on_heap_addr, raw_value);
}
#ifdef V8_COMPRESS_POINTERS
......
......@@ -99,12 +99,11 @@ Node* GraphAssembler::IntPtrEqual(Node* left, Node* right) {
}
Node* GraphAssembler::TaggedEqual(Node* left, Node* right) {
#ifdef V8_COMPRESS_POINTERS
return Word32Equal(ChangeTaggedToCompressed(left),
ChangeTaggedToCompressed(right));
#else
if (COMPRESS_POINTERS_BOOL) {
return Word32Equal(ChangeTaggedToCompressed(left),
ChangeTaggedToCompressed(right));
}
return WordEqual(left, right);
#endif
}
Node* GraphAssembler::Float64RoundDown(Node* value) {
......
......@@ -1272,7 +1272,7 @@ Node* RepresentationChanger::GetBitRepresentationFor(
}
}
} else if (output_rep == MachineRepresentation::kTaggedSigned) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
node = jsgraph()->graph()->NewNode(machine()->Word32Equal(), node,
jsgraph()->Int32Constant(0));
} else {
......
......@@ -2667,7 +2667,7 @@ class RepresentationSelector {
case IrOpcode::kReferenceEqual: {
VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit);
if (lower()) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal());
} else {
NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
......
......@@ -3046,7 +3046,7 @@ Node* WasmGraphBuilder::BuildChangeInt32ToIntPtr(Node* value) {
}
Node* WasmGraphBuilder::BuildChangeInt32ToSmi(Node* value) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
return graph()->NewNode(mcgraph()->machine()->Word32Shl(), value,
BuildSmiShiftBitsConstant32());
}
......@@ -3056,7 +3056,7 @@ Node* WasmGraphBuilder::BuildChangeInt32ToSmi(Node* value) {
}
Node* WasmGraphBuilder::BuildChangeUint31ToSmi(Node* value) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
return graph()->NewNode(mcgraph()->machine()->Word32Shl(), value,
BuildSmiShiftBitsConstant32());
}
......@@ -3073,7 +3073,7 @@ Node* WasmGraphBuilder::BuildSmiShiftBitsConstant32() {
}
Node* WasmGraphBuilder::BuildChangeSmiToInt32(Node* value) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
value =
graph()->NewNode(mcgraph()->machine()->TruncateInt64ToInt32(), value);
value = graph()->NewNode(mcgraph()->machine()->Word32Sar(), value,
......@@ -3086,7 +3086,7 @@ Node* WasmGraphBuilder::BuildChangeSmiToInt32(Node* value) {
}
Node* WasmGraphBuilder::BuildChangeSmiToIntPtr(Node* value) {
if (COMPRESS_POINTERS_BOOL && kUseSmiCorruptingPtrDecompression) {
if (COMPRESS_POINTERS_BOOL) {
value = BuildChangeSmiToInt32(value);
return BuildChangeInt32ToIntPtr(value);
}
......
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