From 47eee782263be1132d9917d28c778c0cece33d12 Mon Sep 17 00:00:00 2001 From: xing-yunhao-huawei Date: Tue, 2 Sep 2025 17:21:01 +0800 Subject: [PATCH] Optimize clean code 1. Removed some redundent Labels in profiler_stub_builder.cpp 2. Update comment for ProfileTypeInfo Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICW119?from=project-issue Change-Id: I7832dd036fd6844330bfa53bee1a0871abc5ce18 Signed-off-by: xing-yunhao-huawei --- ecmascript/compiler/profiler_stub_builder.cpp | 10 ------ ecmascript/ic/profile_type_info.h | 35 ++++++++++++------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/ecmascript/compiler/profiler_stub_builder.cpp b/ecmascript/compiler/profiler_stub_builder.cpp index 28a1a2d363..698084870f 100644 --- a/ecmascript/compiler/profiler_stub_builder.cpp +++ b/ecmascript/compiler/profiler_stub_builder.cpp @@ -554,9 +554,6 @@ void ProfilerStubBuilder::ProfileBranch( Label profiler(env); Label icSlotValid(env); Label hasSlot(env); - Label currentIsTrue(env); - Label currentIsFalse(env); - Label genCurrentWeight(env); Label compareLabel(env); Label updateSlot(env); Label preProfile(env); @@ -630,7 +627,6 @@ void ProfilerStubBuilder::TryPreDumpInner(GateRef glue, GateRef func, GateRef pr Label subEntry(env); env->SubCfgEntry(&subEntry); Label setPreDumpPeriodIndex(env); - Label isInPredumpWorkList(env); Label addPredumpWorkList(env); Label exit(env); BRANCH(IsProfileTypeInfoPreDumped(profileTypeInfo), &exit, &setPreDumpPeriodIndex); @@ -834,7 +830,6 @@ GateRef ProfilerStubBuilder::IsProfileTypeInfoHotAndValid(GateRef profileTypeInf env->SubCfgEntry(&subEntry); Label exit(env); Label isHot(env); - Label hotAndValid(env); DEFVARIABLE(res, VariableType::BOOL(), Boolean(false)); BRANCH(TaggedIsUndefined(profileTypeInfo), &exit, &isHot); Bind(&isHot); @@ -971,15 +966,10 @@ GateRef ProfilerStubBuilder::IsCompiledOrTryCompile(GateRef glue, [[maybe_unused GateRef hotnessThreshold = GetJitHotnessThreshold(profileTypeInfo); GateRef jitCallCnt = GetJitCallCnt(profileTypeInfo); - Label cmpJitHotnessCnt(env); - Label checkJitCallThreshold(env); Label cmpJitCallThreshold(env); Label jitCallNotEqualZero(env); - Label checkJitCallEqualZero(env); Label setResultAsTrue(env); Label exit(env); - Label jitCheck(env); - Label cmpBaselineJitHotnessCnt(env); Label tryCompile(env); Branch(Int32Equal(hotnessThreshold, Int32(ProfileTypeInfo::JIT_DISABLE_FLAG)), diff --git a/ecmascript/ic/profile_type_info.h b/ecmascript/ic/profile_type_info.h index 48ded9bf0d..a18993ea6f 100644 --- a/ecmascript/ic/profile_type_info.h +++ b/ecmascript/ic/profile_type_info.h @@ -101,19 +101,28 @@ private: /** * ProfileTypeInfo - * +--------------------------------+ - * | ic slot | - * | ..... | - * +--------------------------------+ - * | 64 bits jit osr | - * | tagged array address | - * +--------------------------------+ - * | low 32 bits(PeriodCount) | - * | hight 32 bits(jit hotness) | - * +--------------------------------+ - * | low 32 bits(osr hotness) | - * | hight 32 bits(baseline hotness)| - * +--------------------------------+ + * +--------------------------------+ --- TaggedArray Length + * | ic slot | ^ + * | ..... | | + * +--------------------------------+ | --- Reserved Length + * | extra info map | 64 bits | ^ = 4 * 64 bits + * +--------------------------------+ | | + * | jit osr | 64 bits | | + * +--------------------------------+ | | + * | bit field | 32 bits | | + * +--------------------------------+ | | + * | jit hotness threshold | 16 bits | | + * +--------------------------------+ | | + * | jit cnt | 16 bits | | + * +--------------------------------+ | | + * | osr hotness threshold | 16 bits | | + * +--------------------------------+ | | + * | osr cnt | 16 bits | | + * +--------------------------------+ | | + * | baselinejit hotness threshold | 16 bits | | + * +--------------------------------+ | | + * | jit call cnt | 16 bits v v + * +--------------------------------+ --- --- */ class ProfileTypeInfo : public TaggedArray { public: -- Gitee