Commit 83bd11c8 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[x64][ptr-compr][cleanup] Remove DecompressRegisterAnyTagged

It was just an add used only in one place, so I inlined it.

I also noticed that some methods were using scratch registers as
parameters but didn't really need to do so.

Bug: v8:7703
Change-Id: Ia1e5570d478673cb0835cff97e3a37d9a35c60a6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1924266Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65097}
parent 10540937
...@@ -718,7 +718,6 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { ...@@ -718,7 +718,6 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
kDontSaveFPRegs); kDontSaveFPRegs);
Register decompr_scratch1 = COMPRESS_POINTERS_BOOL ? r11 : no_reg; Register decompr_scratch1 = COMPRESS_POINTERS_BOOL ? r11 : no_reg;
Register decompr_scratch2 = COMPRESS_POINTERS_BOOL ? r12 : no_reg;
// Load suspended function and context. // Load suspended function and context.
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
...@@ -782,7 +781,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { ...@@ -782,7 +781,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
__ j(greater_equal, &done_loop, Label::kNear); __ j(greater_equal, &done_loop, Label::kNear);
__ PushTaggedAnyField( __ PushTaggedAnyField(
FieldOperand(rbx, r9, times_tagged_size, FixedArray::kHeaderSize), FieldOperand(rbx, r9, times_tagged_size, FixedArray::kHeaderSize),
decompr_scratch1, decompr_scratch2); decompr_scratch1);
__ addl(r9, Immediate(1)); __ addl(r9, Immediate(1));
__ jmp(&loop); __ jmp(&loop);
...@@ -1071,13 +1070,11 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { ...@@ -1071,13 +1070,11 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// is optimized code or an optimization marker, call that instead. // is optimized code or an optimization marker, call that instead.
Register optimized_code_entry = rcx; Register optimized_code_entry = rcx;
Register decompr_scratch = COMPRESS_POINTERS_BOOL ? r11 : no_reg;
__ LoadAnyTaggedField( __ LoadAnyTaggedField(
optimized_code_entry, optimized_code_entry,
FieldOperand(feedback_vector, FieldOperand(feedback_vector,
FeedbackVector::kOptimizedCodeWeakOrSmiOffset), FeedbackVector::kOptimizedCodeWeakOrSmiOffset));
decompr_scratch);
// Check if the optimized code slot is not empty. // Check if the optimized code slot is not empty.
Label optimized_code_slot_not_empty; Label optimized_code_slot_not_empty;
...@@ -1960,7 +1957,6 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm, ...@@ -1960,7 +1957,6 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
// -- rsp[0] : return address // -- rsp[0] : return address
// ----------------------------------- // -----------------------------------
Register scratch = r11; Register scratch = r11;
Register decompr_scratch = COMPRESS_POINTERS_BOOL ? r12 : no_reg;
if (masm->emit_debug_code()) { if (masm->emit_debug_code()) {
// Allow rbx to be a FixedArray, or a FixedDoubleArray if rcx == 0. // Allow rbx to be a FixedArray, or a FixedDoubleArray if rcx == 0.
...@@ -1994,10 +1990,8 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm, ...@@ -1994,10 +1990,8 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
__ cmpl(r9, rcx); __ cmpl(r9, rcx);
__ j(equal, &done, Label::kNear); __ j(equal, &done, Label::kNear);
// Turn the hole into undefined as we go. // Turn the hole into undefined as we go.
__ LoadAnyTaggedField( __ LoadAnyTaggedField(value, FieldOperand(rbx, r9, times_tagged_size,
value, FixedArray::kHeaderSize));
FieldOperand(rbx, r9, times_tagged_size, FixedArray::kHeaderSize),
decompr_scratch);
__ CompareRoot(value, RootIndex::kTheHoleValue); __ CompareRoot(value, RootIndex::kTheHoleValue);
__ j(not_equal, &push, Label::kNear); __ j(not_equal, &push, Label::kNear);
__ LoadRoot(value, RootIndex::kUndefinedValue); __ LoadRoot(value, RootIndex::kUndefinedValue);
...@@ -2241,8 +2235,6 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { ...@@ -2241,8 +2235,6 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
// -- rdi : target (checked to be a JSBoundFunction) // -- rdi : target (checked to be a JSBoundFunction)
// ----------------------------------- // -----------------------------------
Register decompr_scratch = COMPRESS_POINTERS_BOOL ? r11 : no_reg;
// Load [[BoundArguments]] into rcx and length of that into rbx. // Load [[BoundArguments]] into rcx and length of that into rbx.
Label no_bound_arguments; Label no_bound_arguments;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
...@@ -2311,10 +2303,9 @@ void Generate_PushBoundArguments(MacroAssembler* masm) { ...@@ -2311,10 +2303,9 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
// offset in order to move be able to move decl(rbx) right before the loop // offset in order to move be able to move decl(rbx) right before the loop
// condition. This is necessary in order to avoid flags corruption by // condition. This is necessary in order to avoid flags corruption by
// pointer decompression code. // pointer decompression code.
__ LoadAnyTaggedField(r12, __ LoadAnyTaggedField(
FieldOperand(rcx, rbx, times_tagged_size, r12, FieldOperand(rcx, rbx, times_tagged_size,
FixedArray::kHeaderSize - kTaggedSize), FixedArray::kHeaderSize - kTaggedSize));
decompr_scratch);
__ movq(Operand(rsp, rax, times_system_pointer_size, 0), r12); __ movq(Operand(rsp, rax, times_system_pointer_size, 0), r12);
__ leal(rax, Operand(rax, 1)); __ leal(rax, Operand(rax, 1));
__ decl(rbx); __ decl(rbx);
...@@ -2339,13 +2330,10 @@ void Builtins::Generate_CallBoundFunctionImpl(MacroAssembler* masm) { ...@@ -2339,13 +2330,10 @@ void Builtins::Generate_CallBoundFunctionImpl(MacroAssembler* masm) {
// ----------------------------------- // -----------------------------------
__ AssertBoundFunction(rdi); __ AssertBoundFunction(rdi);
Register decompr_scratch = COMPRESS_POINTERS_BOOL ? r11 : no_reg;
// Patch the receiver to [[BoundThis]]. // Patch the receiver to [[BoundThis]].
StackArgumentsAccessor args(rsp, rax); StackArgumentsAccessor args(rsp, rax);
__ LoadAnyTaggedField(rbx, __ LoadAnyTaggedField(rbx,
FieldOperand(rdi, JSBoundFunction::kBoundThisOffset), FieldOperand(rdi, JSBoundFunction::kBoundThisOffset));
decompr_scratch);
__ movq(args.GetReceiverOperand(), rbx); __ movq(args.GetReceiverOperand(), rbx);
// Push the [[BoundArguments]] onto the stack. // Push the [[BoundArguments]] onto the stack.
...@@ -3122,10 +3110,8 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { ...@@ -3122,10 +3110,8 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) {
Register callback = ApiGetterDescriptor::CallbackRegister(); Register callback = ApiGetterDescriptor::CallbackRegister();
Register scratch = rax; Register scratch = rax;
Register decompr_scratch1 = COMPRESS_POINTERS_BOOL ? r11 : no_reg; Register decompr_scratch1 = COMPRESS_POINTERS_BOOL ? r11 : no_reg;
Register decompr_scratch2 = COMPRESS_POINTERS_BOOL ? r12 : no_reg;
DCHECK(!AreAliased(receiver, holder, callback, scratch, decompr_scratch1, DCHECK(!AreAliased(receiver, holder, callback, scratch, decompr_scratch1));
decompr_scratch2));
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
// name below the exit frame to make GC aware of them. // name below the exit frame to make GC aware of them.
...@@ -3142,7 +3128,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { ...@@ -3142,7 +3128,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) {
__ PopReturnAddressTo(scratch); __ PopReturnAddressTo(scratch);
__ Push(receiver); __ Push(receiver);
__ PushTaggedAnyField(FieldOperand(callback, AccessorInfo::kDataOffset), __ PushTaggedAnyField(FieldOperand(callback, AccessorInfo::kDataOffset),
decompr_scratch1, decompr_scratch2); decompr_scratch1);
__ LoadRoot(kScratchRegister, RootIndex::kUndefinedValue); __ LoadRoot(kScratchRegister, RootIndex::kUndefinedValue);
__ Push(kScratchRegister); // return value __ Push(kScratchRegister); // return value
__ Push(kScratchRegister); // return value default __ Push(kScratchRegister); // return value default
......
...@@ -219,10 +219,9 @@ void TurboAssembler::LoadTaggedPointerField(Register destination, ...@@ -219,10 +219,9 @@ void TurboAssembler::LoadTaggedPointerField(Register destination,
} }
void TurboAssembler::LoadAnyTaggedField(Register destination, void TurboAssembler::LoadAnyTaggedField(Register destination,
Operand field_operand, Operand field_operand) {
Register scratch) {
if (COMPRESS_POINTERS_BOOL) { if (COMPRESS_POINTERS_BOOL) {
DecompressAnyTagged(destination, field_operand, scratch); DecompressAnyTagged(destination, field_operand);
} else { } else {
mov_tagged(destination, field_operand); mov_tagged(destination, field_operand);
} }
...@@ -240,13 +239,11 @@ void TurboAssembler::PushTaggedPointerField(Operand field_operand, ...@@ -240,13 +239,11 @@ void TurboAssembler::PushTaggedPointerField(Operand field_operand,
} }
void TurboAssembler::PushTaggedAnyField(Operand field_operand, void TurboAssembler::PushTaggedAnyField(Operand field_operand,
Register scratch1, Register scratch2) { Register scratch) {
if (COMPRESS_POINTERS_BOOL) { if (COMPRESS_POINTERS_BOOL) {
DCHECK(!AreAliased(scratch1, scratch2)); DCHECK(!field_operand.AddressUsesRegister(scratch));
DCHECK(!field_operand.AddressUsesRegister(scratch1)); DecompressAnyTagged(scratch, field_operand);
DCHECK(!field_operand.AddressUsesRegister(scratch2)); Push(scratch);
DecompressAnyTagged(scratch1, field_operand, scratch2);
Push(scratch1);
} else { } else {
Push(field_operand); Push(field_operand);
} }
...@@ -297,18 +294,11 @@ void TurboAssembler::DecompressTaggedPointer(Register destination, ...@@ -297,18 +294,11 @@ void TurboAssembler::DecompressTaggedPointer(Register destination,
RecordComment("]"); RecordComment("]");
} }
void TurboAssembler::DecompressRegisterAnyTagged(Register destination,
Register scratch) {
addq(destination, kRootRegister);
}
void TurboAssembler::DecompressAnyTagged(Register destination, void TurboAssembler::DecompressAnyTagged(Register destination,
Operand field_operand, Operand field_operand) {
Register scratch) {
DCHECK(!AreAliased(destination, scratch));
RecordComment("[ DecompressAnyTagged"); RecordComment("[ DecompressAnyTagged");
movl(destination, field_operand); movl(destination, field_operand);
DecompressRegisterAnyTagged(destination, scratch); addq(destination, kRootRegister);
RecordComment("]"); RecordComment("]");
} }
......
...@@ -551,10 +551,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -551,10 +551,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void LoadTaggedPointerField(Register destination, Operand field_operand); void LoadTaggedPointerField(Register destination, Operand field_operand);
// Loads a field containing any tagged value and decompresses it if necessary. // Loads a field containing any tagged value and decompresses it if necessary.
// When pointer compression is enabled, uses |scratch| to decompress the void LoadAnyTaggedField(Register destination, Operand field_operand);
// value.
void LoadAnyTaggedField(Register destination, Operand field_operand,
Register scratch = kScratchRegister);
// Loads a field containing a HeapObject, decompresses it if necessary and // Loads a field containing a HeapObject, decompresses it if necessary and
// pushes full pointer to the stack. When pointer compression is enabled, // pushes full pointer to the stack. When pointer compression is enabled,
...@@ -563,9 +560,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -563,9 +560,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Loads a field containing any tagged value, decompresses it if necessary and // Loads a field containing any tagged value, decompresses it if necessary and
// pushes the full pointer to the stack. When pointer compression is enabled, // pushes the full pointer to the stack. When pointer compression is enabled,
// uses |scratch1| and |scratch2| to decompress the value. // uses |scratch| to decompress the value.
void PushTaggedAnyField(Operand field_operand, Register scratch1, void PushTaggedAnyField(Operand field_operand, Register scratch);
Register scratch2);
// Loads a field containing smi value and untags it. // Loads a field containing smi value and untags it.
void SmiUntagField(Register dst, Operand src); void SmiUntagField(Register dst, Operand src);
...@@ -579,11 +575,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -579,11 +575,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void DecompressTaggedSigned(Register destination, Operand field_operand); void DecompressTaggedSigned(Register destination, Operand field_operand);
void DecompressTaggedPointer(Register destination, Operand field_operand); void DecompressTaggedPointer(Register destination, Operand field_operand);
void DecompressTaggedPointer(Register destination, Register source); void DecompressTaggedPointer(Register destination, Register source);
// Auxiliary function used by DecompressAnyTagged to perform the actual void DecompressAnyTagged(Register destination, Operand field_operand);
// decompression. Assumes destination is already signed extended.
void DecompressRegisterAnyTagged(Register destination, Register scratch);
void DecompressAnyTagged(Register destination, Operand field_operand,
Register scratch = kScratchRegister);
protected: protected:
static const int kSmiShift = kSmiTagSize + kSmiShiftSize; static const int kSmiShift = kSmiTagSize + kSmiShiftSize;
......
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