Commit 28cd7784 authored by Lu Yahan's avatar Lu Yahan Committed by V8 LUCI CQ

[riscv64] Add more Assembler::CodeComment

Port 7d3c3cfb

Change-Id: Ic23388e6aa90e8db9af22bb582a99f7f37b9511b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3353680Reviewed-by: 's avatarji qiu <qiuji@iscas.ac.cn>
Commit-Queue: ji qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#78442}
parent 4e84db3d
......@@ -296,6 +296,7 @@ void TurboAssembler::CallRecordWriteStub(
Register scratch = temps.Acquire();
li(scratch, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(scratch);
RecordComment("]");
} else {
Handle<Code> code_target = isolate()->builtins()->code_handle(builtin);
Call(code_target, RelocInfo::CODE_TARGET);
......@@ -3306,6 +3307,7 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
RecordCommentForOffHeapTrampoline(builtin);
li(t6, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Jump(t6, cond, rs, rt);
RecordComment("]");
return;
}
......@@ -3385,6 +3387,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
RecordCommentForOffHeapTrampoline(builtin);
li(t6, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(t6, cond, rs, rt);
RecordComment("]");
return;
}
......@@ -4153,6 +4156,7 @@ void TurboAssembler::SubOverflow64(Register dst, Register left,
void TurboAssembler::MulOverflow32(Register dst, Register left,
const Operand& right, Register overflow) {
ASM_CODE_COMMENT(this);
UseScratchRegisterScope temps(this);
BlockTrampolinePoolScope block_trampoline_pool(this);
Register right_reg = no_reg;
......@@ -4178,6 +4182,7 @@ void TurboAssembler::MulOverflow32(Register dst, Register left,
void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments,
SaveFPRegsMode save_doubles) {
ASM_CODE_COMMENT(this);
// All parameters are on the stack. a0 has the return value after call.
// If the expected number of arguments of the runtime function is
......@@ -4197,6 +4202,7 @@ void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments,
}
void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
ASM_CODE_COMMENT(this);
const Runtime::Function* function = Runtime::FunctionForId(fid);
DCHECK_EQ(1, function->result_size);
if (function->nargs >= 0) {
......@@ -4207,6 +4213,7 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
bool builtin_exit_frame) {
ASM_CODE_COMMENT(this);
PrepareCEntryFunction(builtin);
Handle<Code> code = CodeFactory::CEntry(isolate(), 1, SaveFPRegsMode::kIgnore,
ArgvMode::kStack, builtin_exit_frame);
......@@ -4216,6 +4223,7 @@ void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
void MacroAssembler::JumpToOffHeapInstructionStream(Address entry) {
// Ld a Address from a constant pool.
// Record a value into constant pool.
ASM_CODE_COMMENT(this);
if (!FLAG_riscv_constant_pool) {
li(kOffHeapTrampolineRegister, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
} else {
......@@ -4229,6 +4237,7 @@ void MacroAssembler::JumpToOffHeapInstructionStream(Address entry) {
void MacroAssembler::LoadWeakValue(Register out, Register in,
Label* target_if_cleared) {
ASM_CODE_COMMENT(this);
Branch(target_if_cleared, eq, in, Operand(kClearedWeakHeapObjectLower32));
And(out, in, Operand(~kWeakHeapObjectMask));
}
......@@ -4238,6 +4247,7 @@ void MacroAssembler::EmitIncrementCounter(StatsCounter* counter, int value,
Register scratch2) {
DCHECK_GT(value, 0);
if (FLAG_native_code_counters && counter->Enabled()) {
ASM_CODE_COMMENT(this);
// This operation has to be exactly 32-bit wide in case the external
// reference table redirects the counter to a uint32_t
// dummy_stats_counter_ field.
......@@ -4253,6 +4263,7 @@ void MacroAssembler::EmitDecrementCounter(StatsCounter* counter, int value,
Register scratch2) {
DCHECK_GT(value, 0);
if (FLAG_native_code_counters && counter->Enabled()) {
ASM_CODE_COMMENT(this);
// This operation has to be exactly 32-bit wide in case the external
// reference table redirects the counter to a uint32_t
// dummy_stats_counter_ field.
......@@ -4335,11 +4346,13 @@ void TurboAssembler::Abort(AbortReason reason) {
}
void TurboAssembler::LoadMap(Register destination, Register object) {
ASM_CODE_COMMENT(this);
LoadTaggedPointerField(destination,
FieldMemOperand(object, HeapObject::kMapOffset));
}
void MacroAssembler::LoadNativeContextSlot(Register dst, int index) {
ASM_CODE_COMMENT(this);
LoadMap(dst, cp);
LoadTaggedPointerField(
dst, FieldMemOperand(
......@@ -4348,6 +4361,7 @@ void MacroAssembler::LoadNativeContextSlot(Register dst, int index) {
}
void TurboAssembler::StubPrologue(StackFrame::Type type) {
ASM_CODE_COMMENT(this);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand(StackFrame::TypeToMarker(type)));
......@@ -4357,6 +4371,7 @@ void TurboAssembler::StubPrologue(StackFrame::Type type) {
void TurboAssembler::Prologue() { PushStandardFrame(a1); }
void TurboAssembler::EnterFrame(StackFrame::Type type) {
ASM_CODE_COMMENT(this);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
BlockTrampolinePoolScope block_trampoline_pool(this);
......@@ -4372,6 +4387,7 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
}
void TurboAssembler::LeaveFrame(StackFrame::Type type) {
ASM_CODE_COMMENT(this);
addi(sp, fp, 2 * kSystemPointerSize);
Ld(ra, MemOperand(fp, 1 * kSystemPointerSize));
Ld(fp, MemOperand(fp, 0 * kSystemPointerSize));
......@@ -4379,6 +4395,7 @@ void TurboAssembler::LeaveFrame(StackFrame::Type type) {
void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
StackFrame::Type frame_type) {
ASM_CODE_COMMENT(this);
DCHECK(frame_type == StackFrame::EXIT ||
frame_type == StackFrame::BUILTIN_EXIT);
......@@ -4461,6 +4478,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count,
bool do_return,
bool argument_count_is_length) {
ASM_CODE_COMMENT(this);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
BlockTrampolinePoolScope block_trampoline_pool(this);
......@@ -4532,6 +4550,7 @@ int TurboAssembler::ActivationFrameAlignment() {
void MacroAssembler::AssertStackIsAligned() {
if (FLAG_debug_code) {
ASM_CODE_COMMENT(this);
const int frame_alignment = ActivationFrameAlignment();
const int frame_alignment_mask = frame_alignment - 1;
......@@ -4552,6 +4571,7 @@ void MacroAssembler::AssertStackIsAligned() {
}
void TurboAssembler::SmiUntag(Register dst, const MemOperand& src) {
ASM_CODE_COMMENT(this);
if (SmiValuesAre32Bits()) {
Lw(dst, MemOperand(src.rm(), SmiWordOffset(src.offset())));
} else {
......@@ -4566,6 +4586,7 @@ void TurboAssembler::SmiUntag(Register dst, const MemOperand& src) {
}
void TurboAssembler::SmiToInt32(Register smi) {
ASM_CODE_COMMENT(this);
if (FLAG_enable_slow_asserts) {
AssertSmi(smi);
}
......@@ -4574,6 +4595,7 @@ void TurboAssembler::SmiToInt32(Register smi) {
}
void TurboAssembler::JumpIfSmi(Register value, Label* smi_label) {
ASM_CODE_COMMENT(this);
DCHECK_EQ(0, kSmiTag);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
......@@ -4582,6 +4604,7 @@ void TurboAssembler::JumpIfSmi(Register value, Label* smi_label) {
}
void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
ASM_CODE_COMMENT(this);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
DCHECK_EQ(0, kSmiTag);
......@@ -4591,6 +4614,7 @@ void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
void TurboAssembler::AssertNotSmi(Register object, AbortReason reason) {
if (FLAG_debug_code) {
ASM_CODE_COMMENT(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
andi(kScratchReg, object, kSmiTagMask);
......@@ -4600,6 +4624,7 @@ void TurboAssembler::AssertNotSmi(Register object, AbortReason reason) {
void TurboAssembler::AssertSmi(Register object, AbortReason reason) {
if (FLAG_debug_code) {
ASM_CODE_COMMENT(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
andi(kScratchReg, object, kSmiTagMask);
......@@ -4609,6 +4634,7 @@ void TurboAssembler::AssertSmi(Register object, AbortReason reason) {
void MacroAssembler::AssertConstructor(Register object) {
if (FLAG_debug_code) {
ASM_CODE_COMMENT(this);
DCHECK(object != kScratchReg);
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
......@@ -4626,6 +4652,7 @@ void MacroAssembler::AssertConstructor(Register object) {
void MacroAssembler::AssertFunction(Register object) {
if (FLAG_debug_code) {
ASM_CODE_COMMENT(this);
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
......@@ -4646,6 +4673,7 @@ void MacroAssembler::AssertFunction(Register object) {
void MacroAssembler::AssertCallableFunction(Register object) {
if (!FLAG_debug_code) return;
ASM_CODE_COMMENT(this);
ASM_CODE_COMMENT(this);
STATIC_ASSERT(kSmiTag == 0);
AssertNotSmi(object, AbortReason::kOperandIsASmiAndNotAFunction);
push(object);
......@@ -4661,6 +4689,7 @@ void MacroAssembler::AssertCallableFunction(Register object) {
void MacroAssembler::AssertBoundFunction(Register object) {
if (FLAG_debug_code) {
ASM_CODE_COMMENT(this);
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
......@@ -4675,6 +4704,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!FLAG_debug_code) return;
ASM_CODE_COMMENT(this);
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
......@@ -4703,6 +4733,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (FLAG_debug_code) {
ASM_CODE_COMMENT(this);
Label done_checking;
AssertNotSmi(object);
LoadRoot(scratch, RootIndex::kUndefinedValue);
......@@ -4772,21 +4803,25 @@ void TurboAssembler::FloatMinMaxHelper(FPURegister dst, FPURegister src1,
void TurboAssembler::Float32Max(FPURegister dst, FPURegister src1,
FPURegister src2) {
ASM_CODE_COMMENT(this);
FloatMinMaxHelper<float>(dst, src1, src2, MaxMinKind::kMax);
}
void TurboAssembler::Float32Min(FPURegister dst, FPURegister src1,
FPURegister src2) {
ASM_CODE_COMMENT(this);
FloatMinMaxHelper<float>(dst, src1, src2, MaxMinKind::kMin);
}
void TurboAssembler::Float64Max(FPURegister dst, FPURegister src1,
FPURegister src2) {
ASM_CODE_COMMENT(this);
FloatMinMaxHelper<double>(dst, src1, src2, MaxMinKind::kMax);
}
void TurboAssembler::Float64Min(FPURegister dst, FPURegister src1,
FPURegister src2) {
ASM_CODE_COMMENT(this);
FloatMinMaxHelper<double>(dst, src1, src2, MaxMinKind::kMin);
}
......@@ -4811,6 +4846,7 @@ int TurboAssembler::CalculateStackPassedDWords(int num_gp_arguments,
void TurboAssembler::PrepareCallCFunction(int num_reg_arguments,
int num_double_arguments,
Register scratch) {
ASM_CODE_COMMENT(this);
int frame_alignment = ActivationFrameAlignment();
// Up to eight simple arguments in a0..a7, fa0..fa7.
......@@ -4863,6 +4899,7 @@ void TurboAssembler::CallCFunctionHelper(Register function,
int num_double_arguments) {
DCHECK_LE(num_reg_arguments + num_double_arguments, kMaxCParameters);
DCHECK(has_frame());
ASM_CODE_COMMENT(this);
// Make sure that the stack is aligned before calling a C function unless
// running in the simulator. The simulator has its own alignment check which
// provides more information.
......@@ -4994,6 +5031,7 @@ void TurboAssembler::ComputeCodeStartAddress(Register dst) {
void TurboAssembler::CallForDeoptimization(Builtin target, int, Label* exit,
DeoptimizeKind kind, Label* ret,
Label*) {
ASM_CODE_COMMENT(this);
BlockTrampolinePoolScope block_trampoline_pool(this);
Ld(t6,
MemOperand(kRootRegister, IsolateData::BuiltinEntrySlotOffset(target)));
......@@ -5019,7 +5057,7 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
// * Codegen at runtime does not have this restriction and we can use the
// shorter, branchless instruction sequence. The assumption here is that
// targets are usually generated code and not builtin Code objects.
ASM_CODE_COMMENT(this);
if (options().isolate_independent_code) {
DCHECK(root_array_available());
Label if_code_is_off_heap, out;
......@@ -5058,11 +5096,13 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
}
void TurboAssembler::CallCodeObject(Register code_object) {
ASM_CODE_COMMENT(this);
LoadCodeObjectEntry(code_object, code_object);
Call(code_object);
}
void TurboAssembler::JumpCodeObject(Register code_object, JumpMode jump_mode) {
ASM_CODE_COMMENT(this);
DCHECK_EQ(JumpMode::kJump, jump_mode);
LoadCodeObjectEntry(code_object, code_object);
Jump(code_object);
......@@ -5110,38 +5150,34 @@ void TurboAssembler::StoreTaggedField(const Register& value,
void TurboAssembler::DecompressTaggedSigned(const Register& destination,
const MemOperand& field_operand) {
RecordComment("[ DecompressTaggedSigned");
ASM_CODE_COMMENT(this);
Lwu(destination, field_operand);
if (FLAG_debug_code) {
// Corrupt the top 32 bits. Made up of 16 fixed bits and 16 pc offset bits.
Add64(destination, destination,
Operand(((kDebugZapValue << 16) | (pc_offset() & 0xffff)) << 32));
}
RecordComment("]");
}
void TurboAssembler::DecompressTaggedPointer(const Register& destination,
const MemOperand& field_operand) {
RecordComment("[ DecompressTaggedPointer");
ASM_CODE_COMMENT(this);
Lwu(destination, field_operand);
Add64(destination, kPtrComprCageBaseRegister, destination);
RecordComment("]");
}
void TurboAssembler::DecompressTaggedPointer(const Register& destination,
const Register& source) {
RecordComment("[ DecompressTaggedPointer");
ASM_CODE_COMMENT(this);
And(destination, source, Operand(0xFFFFFFFF));
Add64(destination, kPtrComprCageBaseRegister, Operand(destination));
RecordComment("]");
}
void TurboAssembler::DecompressAnyTagged(const Register& destination,
const MemOperand& field_operand) {
RecordComment("[ DecompressAnyTagged");
ASM_CODE_COMMENT(this);
Lwu(destination, field_operand);
Add64(destination, kPtrComprCageBaseRegister, destination);
RecordComment("]");
}
void MacroAssembler::DropArguments(Register count, ArgumentsCountType type,
......
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