[codegen] Remove PrepareForTailCall
This is no longer used, tail calls are dealt with inside of VisiTailCall. Bug: v8:11879 Change-Id: I3e5b74c61c959a6697bc3fd05c8f9aa60cce9fa7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3049570 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Zhi An Ng <zhin@chromium.org> Cr-Commit-Position: refs/heads/master@{#75931}
This commit is contained in:
parent
64d1947200
commit
ec7171608b
@ -1554,54 +1554,6 @@ void TurboAssembler::MovFromFloatParameter(DwVfpRegister dst) {
|
||||
MovFromFloatResult(dst);
|
||||
}
|
||||
|
||||
void TurboAssembler::PrepareForTailCall(Register callee_args_count,
|
||||
Register caller_args_count,
|
||||
Register scratch0, Register scratch1) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(!AreAliased(callee_args_count, caller_args_count, scratch0, scratch1));
|
||||
|
||||
// Calculate the end of destination area where we will put the arguments
|
||||
// after we drop current frame. We add kPointerSize to count the receiver
|
||||
// argument which is not included into formal parameters count.
|
||||
Register dst_reg = scratch0;
|
||||
add(dst_reg, fp, Operand(caller_args_count, LSL, kPointerSizeLog2));
|
||||
add(dst_reg, dst_reg,
|
||||
Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize));
|
||||
|
||||
Register src_reg = caller_args_count;
|
||||
// Calculate the end of source area. +kPointerSize is for the receiver.
|
||||
add(src_reg, sp, Operand(callee_args_count, LSL, kPointerSizeLog2));
|
||||
add(src_reg, src_reg, Operand(kPointerSize));
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
cmp(src_reg, dst_reg);
|
||||
Check(lo, AbortReason::kStackAccessBelowStackPointer);
|
||||
}
|
||||
|
||||
// Restore caller's frame pointer and return address now as they will be
|
||||
// overwritten by the copying loop.
|
||||
ldr(lr, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
|
||||
ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
||||
|
||||
// Now copy callee arguments to the caller frame going backwards to avoid
|
||||
// callee arguments corruption (source and destination areas could overlap).
|
||||
|
||||
// Both src_reg and dst_reg are pointing to the word after the one to copy,
|
||||
// so they must be pre-decremented in the loop.
|
||||
Register tmp_reg = scratch1;
|
||||
Label loop, entry;
|
||||
b(&entry);
|
||||
bind(&loop);
|
||||
ldr(tmp_reg, MemOperand(src_reg, -kPointerSize, PreIndex));
|
||||
str(tmp_reg, MemOperand(dst_reg, -kPointerSize, PreIndex));
|
||||
bind(&entry);
|
||||
cmp(sp, src_reg);
|
||||
b(ne, &loop);
|
||||
|
||||
// Leave current frame.
|
||||
mov(sp, dst_reg);
|
||||
}
|
||||
|
||||
void MacroAssembler::LoadStackLimit(Register destination, StackLimitKind kind) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(root_array_available());
|
||||
|
@ -233,15 +233,6 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
void PrepareCallCFunction(int num_reg_arguments, int num_double_registers = 0,
|
||||
Register scratch = no_reg);
|
||||
|
||||
// Removes current frame and its arguments from the stack preserving
|
||||
// the arguments and a return address pushed to the stack for the next call.
|
||||
// Both |callee_args_count| and |caller_args_count| do not include
|
||||
// receiver. |callee_args_count| is not modified. |caller_args_count|
|
||||
// is trashed.
|
||||
void PrepareForTailCall(Register callee_args_count,
|
||||
Register caller_args_count, Register scratch0,
|
||||
Register scratch1);
|
||||
|
||||
// There are two ways of passing double arguments on ARM, depending on
|
||||
// whether soft or hard floating point ABI is used. These functions
|
||||
// abstract parameter passing for the three different ways we call
|
||||
|
@ -2215,62 +2215,6 @@ void TurboAssembler::CallForDeoptimization(
|
||||
}
|
||||
}
|
||||
|
||||
void TurboAssembler::PrepareForTailCall(Register callee_args_count,
|
||||
Register caller_args_count,
|
||||
Register scratch0, Register scratch1) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(!AreAliased(callee_args_count, caller_args_count, scratch0, scratch1));
|
||||
|
||||
// Calculate the end of destination area where we will put the arguments
|
||||
// after we drop current frame. We add kSystemPointerSize to count the
|
||||
// receiver argument which is not included into formal parameters count.
|
||||
Register dst_reg = scratch0;
|
||||
Add(dst_reg, fp, Operand(caller_args_count, LSL, kSystemPointerSizeLog2));
|
||||
Add(dst_reg, dst_reg,
|
||||
StandardFrameConstants::kCallerSPOffset + kSystemPointerSize);
|
||||
// Round dst_reg up to a multiple of 16 bytes, so that we overwrite any
|
||||
// potential padding.
|
||||
Add(dst_reg, dst_reg, 15);
|
||||
Bic(dst_reg, dst_reg, 15);
|
||||
|
||||
Register src_reg = caller_args_count;
|
||||
// Calculate the end of source area. +kSystemPointerSize is for the receiver.
|
||||
Add(src_reg, sp, Operand(callee_args_count, LSL, kSystemPointerSizeLog2));
|
||||
Add(src_reg, src_reg, kSystemPointerSize);
|
||||
|
||||
// Round src_reg up to a multiple of 16 bytes, so we include any potential
|
||||
// padding in the copy.
|
||||
Add(src_reg, src_reg, 15);
|
||||
Bic(src_reg, src_reg, 15);
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
Cmp(src_reg, dst_reg);
|
||||
Check(lo, AbortReason::kStackAccessBelowStackPointer);
|
||||
}
|
||||
|
||||
// Restore caller's frame pointer and return address now as they will be
|
||||
// overwritten by the copying loop.
|
||||
RestoreFPAndLR();
|
||||
|
||||
// Now copy callee arguments to the caller frame going backwards to avoid
|
||||
// callee arguments corruption (source and destination areas could overlap).
|
||||
|
||||
// Both src_reg and dst_reg are pointing to the word after the one to copy,
|
||||
// so they must be pre-decremented in the loop.
|
||||
Register tmp_reg = scratch1;
|
||||
Label loop, entry;
|
||||
B(&entry);
|
||||
bind(&loop);
|
||||
Ldr(tmp_reg, MemOperand(src_reg, -kSystemPointerSize, PreIndex));
|
||||
Str(tmp_reg, MemOperand(dst_reg, -kSystemPointerSize, PreIndex));
|
||||
bind(&entry);
|
||||
Cmp(sp, src_reg);
|
||||
B(ne, &loop);
|
||||
|
||||
// Leave current frame.
|
||||
Mov(sp, dst_reg);
|
||||
}
|
||||
|
||||
void MacroAssembler::LoadStackLimit(Register destination, StackLimitKind kind) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(root_array_available());
|
||||
|
@ -555,15 +555,6 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
inline void Isb();
|
||||
inline void Csdb();
|
||||
|
||||
// Removes current frame and its arguments from the stack preserving
|
||||
// the arguments and a return address pushed to the stack for the next call.
|
||||
// Both |callee_args_count| and |caller_args_count| do not include
|
||||
// receiver. |callee_args_count| is not modified. |caller_args_count| is
|
||||
// trashed.
|
||||
void PrepareForTailCall(Register callee_args_count,
|
||||
Register caller_args_count, Register scratch0,
|
||||
Register scratch1);
|
||||
|
||||
inline void SmiUntag(Register dst, Register src);
|
||||
inline void SmiUntag(Register dst, const MemOperand& src);
|
||||
inline void SmiUntag(Register smi);
|
||||
|
@ -1431,60 +1431,6 @@ void MacroAssembler::JumpToInstructionStream(Address entry) {
|
||||
jmp(entry, RelocInfo::OFF_HEAP_TARGET);
|
||||
}
|
||||
|
||||
void TurboAssembler::PrepareForTailCall(
|
||||
Register callee_args_count, Register caller_args_count, Register scratch0,
|
||||
Register scratch1, int number_of_temp_values_after_return_address) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(!AreAliased(callee_args_count, caller_args_count, scratch0, scratch1));
|
||||
|
||||
// Calculate the destination address where we will put the return address
|
||||
// after we drop current frame.
|
||||
Register new_sp_reg = scratch0;
|
||||
sub(caller_args_count, callee_args_count);
|
||||
lea(new_sp_reg, Operand(ebp, caller_args_count, times_system_pointer_size,
|
||||
StandardFrameConstants::kCallerPCOffset -
|
||||
number_of_temp_values_after_return_address *
|
||||
kSystemPointerSize));
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
cmp(esp, new_sp_reg);
|
||||
Check(below, AbortReason::kStackAccessBelowStackPointer);
|
||||
}
|
||||
|
||||
// Copy return address from caller's frame to current frame's return address
|
||||
// to avoid its trashing and let the following loop copy it to the right
|
||||
// place.
|
||||
Register tmp_reg = scratch1;
|
||||
mov(tmp_reg, Operand(ebp, StandardFrameConstants::kCallerPCOffset));
|
||||
mov(Operand(esp,
|
||||
number_of_temp_values_after_return_address * kSystemPointerSize),
|
||||
tmp_reg);
|
||||
|
||||
// Restore caller's frame pointer now as it could be overwritten by
|
||||
// the copying loop.
|
||||
mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
|
||||
|
||||
// +2 here is to copy both receiver and return address.
|
||||
Register count_reg = caller_args_count;
|
||||
lea(count_reg, Operand(callee_args_count,
|
||||
2 + number_of_temp_values_after_return_address));
|
||||
|
||||
// Now copy callee arguments to the caller frame going backwards to avoid
|
||||
// callee arguments corruption (source and destination areas could overlap).
|
||||
Label loop, entry;
|
||||
jmp(&entry, Label::kNear);
|
||||
bind(&loop);
|
||||
dec(count_reg);
|
||||
mov(tmp_reg, Operand(esp, count_reg, times_system_pointer_size, 0));
|
||||
mov(Operand(new_sp_reg, count_reg, times_system_pointer_size, 0), tmp_reg);
|
||||
bind(&entry);
|
||||
cmp(count_reg, Immediate(0));
|
||||
j(not_equal, &loop, Label::kNear);
|
||||
|
||||
// Leave current frame.
|
||||
mov(esp, new_sp_reg);
|
||||
}
|
||||
|
||||
void MacroAssembler::CompareStackLimit(Register with, StackLimitKind kind) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(root_array_available());
|
||||
|
@ -203,19 +203,6 @@ class V8_EXPORT_PRIVATE TurboAssembler : public SharedTurboAssembler {
|
||||
SmiUntag(output);
|
||||
}
|
||||
|
||||
// Removes current frame and its arguments from the stack preserving the
|
||||
// arguments and a return address pushed to the stack for the next call. Both
|
||||
// |callee_args_count| and |caller_args_count| do not include receiver.
|
||||
// |callee_args_count| is not modified. |caller_args_count| is trashed.
|
||||
// |number_of_temp_values_after_return_address| specifies the number of words
|
||||
// pushed to the stack after the return address. This is to allow "allocation"
|
||||
// of scratch registers that this function requires by saving their values on
|
||||
// the stack.
|
||||
void PrepareForTailCall(Register callee_args_count,
|
||||
Register caller_args_count, Register scratch0,
|
||||
Register scratch1,
|
||||
int number_of_temp_values_after_return_address);
|
||||
|
||||
// Before calling a C-function from generated code, align arguments on stack.
|
||||
// After aligning the frame, arguments must be stored in esp[0], esp[4],
|
||||
// etc., not pushed. The argument count assumes all arguments are word sized.
|
||||
|
@ -2920,55 +2920,6 @@ void MacroAssembler::EmitDecrementCounter(StatsCounter* counter, int value) {
|
||||
}
|
||||
}
|
||||
|
||||
void TurboAssembler::PrepareForTailCall(Register callee_args_count,
|
||||
Register caller_args_count,
|
||||
Register scratch0, Register scratch1) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(!AreAliased(callee_args_count, caller_args_count, scratch0, scratch1));
|
||||
|
||||
// Calculate the destination address where we will put the return address
|
||||
// after we drop current frame.
|
||||
Register new_sp_reg = scratch0;
|
||||
subq(caller_args_count, callee_args_count);
|
||||
leaq(new_sp_reg, Operand(rbp, caller_args_count, times_system_pointer_size,
|
||||
StandardFrameConstants::kCallerPCOffset));
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
cmpq(rsp, new_sp_reg);
|
||||
Check(below, AbortReason::kStackAccessBelowStackPointer);
|
||||
}
|
||||
|
||||
// Copy return address from caller's frame to current frame's return address
|
||||
// to avoid its trashing and let the following loop copy it to the right
|
||||
// place.
|
||||
Register tmp_reg = scratch1;
|
||||
movq(tmp_reg, Operand(rbp, StandardFrameConstants::kCallerPCOffset));
|
||||
movq(Operand(rsp, 0), tmp_reg);
|
||||
|
||||
// Restore caller's frame pointer now as it could be overwritten by
|
||||
// the copying loop.
|
||||
movq(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
|
||||
|
||||
// +2 here is to copy both receiver and return address.
|
||||
Register count_reg = caller_args_count;
|
||||
leaq(count_reg, Operand(callee_args_count, 2));
|
||||
|
||||
// Now copy callee arguments to the caller frame going backwards to avoid
|
||||
// callee arguments corruption (source and destination areas could overlap).
|
||||
Label loop, entry;
|
||||
jmp(&entry, Label::kNear);
|
||||
bind(&loop);
|
||||
decq(count_reg);
|
||||
movq(tmp_reg, Operand(rsp, count_reg, times_system_pointer_size, 0));
|
||||
movq(Operand(new_sp_reg, count_reg, times_system_pointer_size, 0), tmp_reg);
|
||||
bind(&entry);
|
||||
cmpq(count_reg, Immediate(0));
|
||||
j(not_equal, &loop, Label::kNear);
|
||||
|
||||
// Leave current frame.
|
||||
movq(rsp, new_sp_reg);
|
||||
}
|
||||
|
||||
void MacroAssembler::InvokeFunction(Register function, Register new_target,
|
||||
Register actual_parameter_count,
|
||||
InvokeType type) {
|
||||
|
@ -571,14 +571,6 @@ class V8_EXPORT_PRIVATE TurboAssembler : public SharedTurboAssembler {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Removes current frame and its arguments from the stack preserving the
|
||||
// arguments and a return address pushed to the stack for the next call. Both
|
||||
// |callee_args_count| and |caller_args_count| do not include receiver.
|
||||
// |callee_args_count| is not modified. |caller_args_count| is trashed.
|
||||
void PrepareForTailCall(Register callee_args_count,
|
||||
Register caller_args_count, Register scratch0,
|
||||
Register scratch1);
|
||||
|
||||
void InitializeRootRegister() {
|
||||
ExternalReference isolate_root = ExternalReference::isolate_root(isolate());
|
||||
Move(kRootRegister, isolate_root);
|
||||
|
Loading…
Reference in New Issue
Block a user