From 8990736aeb39a49cbe2fb7429d27d92d3e4c90bc Mon Sep 17 00:00:00 2001 From: yangliping Date: Mon, 11 Aug 2025 11:40:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICSB20?from=project-issue Signed-off-by: yangliping --- ecmascript/compiler/BUILD.gn | 6 +---- .../compiler/access_object_stub_builder.cpp | 14 +++-------- ecmascript/compiler/circuit_builder.h | 4 +-- ecmascript/compiler/common_stub_csigns.h | 4 +-- ecmascript/compiler/deopt_type.h | 2 +- ecmascript/compiler/mcr_circuit_builder.cpp | 16 ++++++------ ecmascript/compiler/mcr_opcodes.h | 10 ++++---- .../compiler/native_inline_lowering.cpp | 14 +++++------ ecmascript/compiler/new_object_stub_builder.h | 2 +- .../compiler/number_speculative_retype.cpp | 25 ++----------------- .../compiler/number_speculative_retype.h | 1 - .../compiler/typed_native_inline_lowering.cpp | 16 ++---------- .../pgo_profiler/pgo_profiler_encoder.cpp | 3 +-- .../pgo_profiler/types/pgo_profile_type.cpp | 7 +----- .../pgo_profiler/types/pgo_profile_type.h | 4 --- test/aottest/BUILD.gn | 3 --- test/aottest/string_slice/BUILD.gn | 22 ---------------- test/aottest/string_slice/expect_output.txt | 15 ----------- .../string_slice/pgo_expect_output.txt | 15 ----------- test/aottest/string_slice/string_slice.ts | 23 ----------------- test/aottest/string_sub_str/BUILD.gn | 22 ---------------- test/aottest/string_sub_str/expect_output.txt | 15 ----------- .../string_sub_str/pgo_expect_output.txt | 15 ----------- test/aottest/string_sub_str/string_sub_str.ts | 23 ----------------- test/aottest/string_sub_string/BUILD.gn | 22 ---------------- .../string_sub_string/expect_output.txt | 15 ----------- .../string_sub_string/pgo_expect_output.txt | 15 ----------- .../string_sub_string/string_sub_string.ts | 23 ----------------- 28 files changed, 35 insertions(+), 321 deletions(-) delete mode 100644 test/aottest/string_slice/BUILD.gn delete mode 100644 test/aottest/string_slice/expect_output.txt delete mode 100644 test/aottest/string_slice/pgo_expect_output.txt delete mode 100644 test/aottest/string_slice/string_slice.ts delete mode 100644 test/aottest/string_sub_str/BUILD.gn delete mode 100644 test/aottest/string_sub_str/expect_output.txt delete mode 100644 test/aottest/string_sub_str/pgo_expect_output.txt delete mode 100644 test/aottest/string_sub_str/string_sub_str.ts delete mode 100644 test/aottest/string_sub_string/BUILD.gn delete mode 100644 test/aottest/string_sub_string/expect_output.txt delete mode 100644 test/aottest/string_sub_string/pgo_expect_output.txt delete mode 100644 test/aottest/string_sub_string/string_sub_string.ts diff --git a/ecmascript/compiler/BUILD.gn b/ecmascript/compiler/BUILD.gn index f8fc059caa..aea743766b 100644 --- a/ecmascript/compiler/BUILD.gn +++ b/ecmascript/compiler/BUILD.gn @@ -17,11 +17,7 @@ declare_args() { skip_gen_stub = false } -if (defined(timeout)) { - _timeout_ = 14400 -} else { - _timeout_ = 2400 -} +_timeout_ = 14400 config("include_maple") { include_dirs = [ diff --git a/ecmascript/compiler/access_object_stub_builder.cpp b/ecmascript/compiler/access_object_stub_builder.cpp index 552eb75fad..4bffc43bba 100644 --- a/ecmascript/compiler/access_object_stub_builder.cpp +++ b/ecmascript/compiler/access_object_stub_builder.cpp @@ -413,12 +413,11 @@ GateRef AccessObjectStubBuilder::StoreOwnByIndex(GateRef glue, GateRef receiver, Label exit(env); Label tryFastPath(env); Label slowPath(env); - Label tryPreDump(env); DEFVARIABLE(result, VariableType::JS_ANY(), Hole()); ICStubBuilder builder(this, GetCurrentGlobalEnv()); builder.SetParameters(glue, receiver, profileTypeInfo, value, slotId, IntToTaggedPtr(index), callback); - builder.StoreICByValue(&result, &tryFastPath, &tryPreDump, &exit); + builder.StoreICByValue(&result, &tryFastPath, &slowPath, &exit); Bind(&tryFastPath); { Label isHeapObject(env); @@ -433,16 +432,11 @@ GateRef AccessObjectStubBuilder::StoreOwnByIndex(GateRef glue, GateRef receiver, result = SetPropertyByIndex(glue, receiver, index, value, true); BRANCH(TaggedIsHole(*result), &slowPath, &exit); } - Bind(&tryPreDump); - { - callback.TryPreDump(); - Jump(&slowPath); - } Bind(&slowPath); { - result = CallRuntime(glue, - RTSTUB_ID(StoreOwnICByValue), - {profileTypeInfo, receiver, IntToTaggedInt(index), value, IntToTaggedInt(slotId)}); + result = CallRuntime(glue, RTSTUB_ID(StoreOwnICByValue), + { profileTypeInfo, receiver, IntToTaggedInt(index), value, IntToTaggedInt(slotId) }); + callback.TryPreDump(); Jump(&exit); } Bind(&exit); diff --git a/ecmascript/compiler/circuit_builder.h b/ecmascript/compiler/circuit_builder.h index 56220329c2..e3fabafb49 100644 --- a/ecmascript/compiler/circuit_builder.h +++ b/ecmascript/compiler/circuit_builder.h @@ -884,9 +884,9 @@ public: void SetMixHashcode(GateRef glue, GateRef str, GateRef rawHashcode); GateRef StringFromSingleCharCode(GateRef gate); GateRef StringCharCodeAt(GateRef thisValue, GateRef posTag); - GateRef StringSubstring(std::vector& args); + GateRef StringSubstring(GateRef thisValue, GateRef startTag, GateRef endTag); GateRef StringSubStr(GateRef thisValue, GateRef intStart, GateRef lengthTag); - GateRef StringSlice(std::vector& args); + GateRef StringSlice(GateRef thisValue, GateRef startTag, GateRef endTag); GateRef NumberIsNaN(GateRef gate); GateRef NumberParseFloat(GateRef gate, GateRef frameState); GateRef NumberParseInt(GateRef gate, GateRef radix); diff --git a/ecmascript/compiler/common_stub_csigns.h b/ecmascript/compiler/common_stub_csigns.h index 0337728fbd..af379e77a8 100644 --- a/ecmascript/compiler/common_stub_csigns.h +++ b/ecmascript/compiler/common_stub_csigns.h @@ -144,21 +144,21 @@ namespace panda::ecmascript::kungfu { V(DeleteObjectProperty) \ V(SameValue) \ V(StringIteratorNext) \ + V(VerifyBarrier) \ V(ArrayIteratorNext) \ V(MapIteratorNext) \ V(SetIteratorNext) \ V(GetIterator) \ V(GrowElementsCapacity) \ V(BatchBarrier) \ - V(VerifyBarrier) \ V(MoveBarrierInRegion) \ V(MoveBarrierCrossRegion) \ V(FindEntryFromNameDictionary) \ V(ReverseBarrier) \ - V(GetValueWithBarrier) \ V(DefineNormalFuncForJit) \ V(DefineArrowFuncForJit) \ V(DefineBaseConstructorForJit) \ + V(GetValueWithBarrier) \ V(CMCSetValueWithBarrier) #define COMMON_STUB_ID_LIST(V) \ diff --git a/ecmascript/compiler/deopt_type.h b/ecmascript/compiler/deopt_type.h index 95160247a4..fbd834a63f 100644 --- a/ecmascript/compiler/deopt_type.h +++ b/ecmascript/compiler/deopt_type.h @@ -134,9 +134,9 @@ namespace panda::ecmascript::kungfu { V(ArrayLengthOverMax, ARRAYLENGTHOVERMAX) \ V(ArrayLengthNotWritable, ARRAYLENGTHNOTWRITABLE) \ V(InsufficientProfile, INSUFFICIENTPROFILE) \ - V(KeyMissmatch, KEYMISSMATCH) \ V(CallTargetNotCompiled, CALLTARGETNOTCOMPILED) \ V(PropertyBoxInvalid, PROPERTYBOXINVALID) \ + V(KeyMissmatch, KEYMISSMATCH) \ V(HotReloadPatchMain, HOTRELOAD_PATCHMAIN) enum class DeoptType : uint8_t { diff --git a/ecmascript/compiler/mcr_circuit_builder.cpp b/ecmascript/compiler/mcr_circuit_builder.cpp index 7154bc495a..434e8839a9 100644 --- a/ecmascript/compiler/mcr_circuit_builder.cpp +++ b/ecmascript/compiler/mcr_circuit_builder.cpp @@ -1833,15 +1833,14 @@ GateRef CircuitBuilder::StringCharCodeAt(GateRef thisValue, GateRef posTag) return ret; } -GateRef CircuitBuilder::StringSubstring(std::vector& args) +GateRef CircuitBuilder::StringSubstring(GateRef thisValue, GateRef startTag, GateRef endTag) { auto currentLabel = env_->GetCurrentLabel(); auto currentControl = currentLabel->GetControl(); auto currentDepend = currentLabel->GetDepend(); - std::vector inList {currentControl, currentDepend}; - inList.insert(inList.end(), args.begin(), args.end()); - GateRef ret = GetCircuit()->NewGate( - circuit_->StringSubstring(args.size()), MachineType::I64, inList, GateType::AnyType()); + GateRef ret = + GetCircuit()->NewGate(circuit_->StringSubstring(), MachineType::I64, + { currentControl, currentDepend, thisValue, startTag, endTag }, GateType::AnyType()); currentLabel->SetControl(ret); currentLabel->SetDepend(ret); return ret; @@ -1860,15 +1859,14 @@ GateRef CircuitBuilder::StringSubStr(GateRef thisValue, GateRef intStart, GateRe return ret; } -GateRef CircuitBuilder::StringSlice(std::vector& args) +GateRef CircuitBuilder::StringSlice(GateRef thisValue, GateRef startTag, GateRef endTag) { auto currentLabel = env_->GetCurrentLabel(); auto currentControl = currentLabel->GetControl(); auto currentDepend = currentLabel->GetDepend(); - std::vector inList {currentControl, currentDepend}; - inList.insert(inList.end(), args.begin(), args.end()); GateRef ret = - GetCircuit()->NewGate(circuit_->StringSlice(args.size()), MachineType::I64, inList, GateType::AnyType()); + GetCircuit()->NewGate(circuit_->StringSlice(), MachineType::I64, + { currentControl, currentDepend, thisValue, startTag, endTag }, GateType::AnyType()); currentLabel->SetControl(ret); currentLabel->SetDepend(ret); return ret; diff --git a/ecmascript/compiler/mcr_opcodes.h b/ecmascript/compiler/mcr_opcodes.h index 2b031c557d..43dd528408 100644 --- a/ecmascript/compiler/mcr_opcodes.h +++ b/ecmascript/compiler/mcr_opcodes.h @@ -68,7 +68,9 @@ namespace panda::ecmascript::kungfu { V(MonoLoadPropertyOnProto, MONO_LOAD_PROPERTY_ON_PROTO, GateFlags::CHECKABLE, 1, 1, 4) \ V(StringFromSingleCharCode, STRING_FROM_SINGLE_CHAR_CODE, GateFlags::NO_WRITE, 1, 1, 1) \ V(StringCharCodeAt, STRING_CHAR_CODE_AT, GateFlags::NO_WRITE, 1, 1, 2) \ + V(StringSubstring, STRING_SUB_STRING, GateFlags::NO_WRITE, 1, 1, 3) \ V(StringSubStr, STRING_SUB_STR, GateFlags::NO_WRITE, 1, 1, 3) \ + V(StringSlice, STRING_SLICE, GateFlags::NO_WRITE, 1, 1, 3) \ V(TypedArrayEntries, TYPED_ARRAY_ENTRIES, GateFlags::NO_WRITE, 1, 1, 1) \ V(TypedArrayKeys, TYPED_ARRAY_KEYS, GateFlags::NO_WRITE, 1, 1, 1) \ V(TypedArrayValues, TYPED_ARRAY_VALUES, GateFlags::NO_WRITE, 1, 1, 1) \ @@ -244,11 +246,9 @@ namespace panda::ecmascript::kungfu { MCR_GATE_META_DATA_LIST_WITH_VALUE(V) \ MCR_GATE_META_DATA_LIST_WITH_GATE_TYPE(V) -#define MCR_GATE_META_DATA_LIST_WITH_VALUE_IN(V) \ - V(StringSlice, STRING_SLICE, GateFlags::NO_WRITE, 1, 1, value) \ - V(StringSubstring, STRING_SUB_STRING, GateFlags::NO_WRITE, 1, 1, value) \ - V(TypedCreateObjWithBuffer, TYPED_CREATE_OBJ_WITH_BUFFER, GateFlags::CHECKABLE, 1, 1, value) \ - V(TypedCallCheck, TYPED_CALL_CHECK, GateFlags::CHECKABLE, 1, 1, value) \ +#define MCR_GATE_META_DATA_LIST_WITH_VALUE_IN(V) \ + V(TypedCreateObjWithBuffer, TYPED_CREATE_OBJ_WITH_BUFFER, GateFlags::CHECKABLE, 1, 1, value) \ + V(TypedCallCheck, TYPED_CALL_CHECK, GateFlags::CHECKABLE, 1, 1, value) \ V(FunctionPrototypeCall, FUNCTION_PROTOTYPE_CALL, GateFlags::NONE_FLAG, 1, 1, value) #define MCR_GATE_META_DATA_LIST_WITH_SIZE(V) \ diff --git a/ecmascript/compiler/native_inline_lowering.cpp b/ecmascript/compiler/native_inline_lowering.cpp index 19712dd008..b10c88c2c6 100644 --- a/ecmascript/compiler/native_inline_lowering.cpp +++ b/ecmascript/compiler/native_inline_lowering.cpp @@ -448,6 +448,7 @@ void NativeInlineLowering::TryInlineStringSubstring(GateRef gate, size_t argc, b CallThis1TypeInfoAccessor tacc(compilationEnv_, circuit_, gate); GateRef thisValue = acc_.GetValueIn(gate, 0); GateRef startTag = tacc.GetArg0(); + GateRef endTag = builder_.GetLengthFromString(thisValue); if (!Uncheck()) { builder_.CallTargetCheck(gate, tacc.GetFunc(), builder_.IntPtr(static_cast(BuiltinsStubCSigns::ID::StringSubstring)), @@ -456,8 +457,7 @@ void NativeInlineLowering::TryInlineStringSubstring(GateRef gate, size_t argc, b auto param_check = builder_.TaggedIsNumber(startTag); builder_.DeoptCheck(param_check, acc_.GetFrameState(gate), DeoptType::BUILTIN_INLINING_TYPE_GUARD); } - std::vector args {thisValue, startTag}; - ret = builder_.StringSubstring(args); + ret = builder_.StringSubstring(thisValue, startTag, endTag); } else { GateRef thisValue = acc_.GetValueIn(gate, 0); GateRef startTag = acc_.GetValueIn(gate, 1); @@ -471,8 +471,7 @@ void NativeInlineLowering::TryInlineStringSubstring(GateRef gate, size_t argc, b .And(builder_.TaggedIsNumber(endTag)).Done(); builder_.DeoptCheck(param_check, acc_.GetFrameState(gate), DeoptType::BUILTIN_INLINING_TYPE_GUARD); } - std::vector args {thisValue, startTag, endTag}; - ret = builder_.StringSubstring(args); + ret = builder_.StringSubstring(thisValue, startTag, endTag); } acc_.ReplaceHirAndReplaceDeadIfException(gate, builder_.GetStateDepend(), ret); } @@ -533,6 +532,7 @@ void NativeInlineLowering::TryInlineStringSlice(GateRef gate, size_t argc, bool CallThis1TypeInfoAccessor tacc(compilationEnv_, circuit_, gate); GateRef thisValue = acc_.GetValueIn(gate, 0); GateRef startTag = tacc.GetArg0(); + GateRef endTag = builder_.GetLengthFromString(thisValue); if (!Uncheck()) { builder_.CallTargetCheck(gate, tacc.GetFunc(), builder_.IntPtr(static_cast(BuiltinsStubCSigns::ID::StringSlice)), @@ -541,8 +541,7 @@ void NativeInlineLowering::TryInlineStringSlice(GateRef gate, size_t argc, bool auto param_check = builder_.TaggedIsNumber(startTag); builder_.DeoptCheck(param_check, acc_.GetFrameState(gate), DeoptType::BUILTIN_INLINING_TYPE_GUARD); } - std::vector args {thisValue, startTag}; - ret = builder_.StringSlice(args); + ret = builder_.StringSlice(thisValue, startTag, endTag); } else { GateRef thisValue = acc_.GetValueIn(gate, 0); GateRef startTag = acc_.GetValueIn(gate, 1); @@ -556,8 +555,7 @@ void NativeInlineLowering::TryInlineStringSlice(GateRef gate, size_t argc, bool .And(builder_.TaggedIsNumber(endTag)).Done(); builder_.DeoptCheck(param_check, acc_.GetFrameState(gate), DeoptType::BUILTIN_INLINING_TYPE_GUARD); } - std::vector args {thisValue, startTag, endTag}; - ret = builder_.StringSlice(args); + ret = builder_.StringSlice(thisValue, startTag, endTag); } acc_.ReplaceHirAndReplaceDeadIfException(gate, builder_.GetStateDepend(), ret); } diff --git a/ecmascript/compiler/new_object_stub_builder.h b/ecmascript/compiler/new_object_stub_builder.h index 9cac3363db..3d426631c1 100644 --- a/ecmascript/compiler/new_object_stub_builder.h +++ b/ecmascript/compiler/new_object_stub_builder.h @@ -123,6 +123,7 @@ public: GateRef NewTrackInfo(GateRef glue, GateRef cachedHClass, GateRef cachedFunc, RegionSpaceFlag spaceFlag, GateRef arraySize); // Note: The size is the num of bytes, it is required to be divisible by 8. + void InitializeObject(Variable *result); void InitializeWithSpeicalValue(Label *exit, GateRef object, GateRef value, GateRef start, GateRef end, MemoryAttribute mAttr = MemoryAttribute::Default()); GateRef FastNewThisObject(GateRef glue, GateRef ctor); @@ -178,7 +179,6 @@ private: void AllocateInSOld(Variable *result, Label *exit, GateRef hclass); void InitializeTaggedArrayWithSpeicalValue(Label *exit, GateRef array, GateRef value, GateRef start, GateRef length); - void InitializeObject(Variable *result); GateRef glue_ {Circuit::NullGate()}; GateRef size_ {0}; }; diff --git a/ecmascript/compiler/number_speculative_retype.cpp b/ecmascript/compiler/number_speculative_retype.cpp index f8c2125ec1..5567527741 100644 --- a/ecmascript/compiler/number_speculative_retype.cpp +++ b/ecmascript/compiler/number_speculative_retype.cpp @@ -275,11 +275,10 @@ GateRef NumberSpeculativeRetype::VisitGate(GateRef gate) case OpCode::MAP_ENTRIES: case OpCode::SET_ENTRIES: case OpCode::SET_VALUES: - return VisitOthersWithoutConvert(gate); + case OpCode::STRING_SLICE: case OpCode::STRING_SUB_STR: case OpCode::STRING_SUB_STRING: - case OpCode::STRING_SLICE: - return VisitString(gate); + return VisitOthersWithoutConvert(gate); case OpCode::ARRAY_INCLUDES_INDEXOF: return VisitArrayIncludesIndexOf(gate); case OpCode::STRING_CHAR_CODE_AT: @@ -2247,26 +2246,6 @@ GateRef NumberSpeculativeRetype::VisitStringCharCodeAt(GateRef gate) return Circuit::NullGate(); } -GateRef NumberSpeculativeRetype::VisitString(GateRef gate) -{ - Environment env(gate, circuit_, &builder_); - if (IsRetype()) { - return SetOutputType(gate, GateType::AnyType()); - } - if (IsConvert()) { - GateRef thisValue = acc_.GetValueIn(gate, 0); - acc_.ReplaceValueIn(gate, ConvertToTagged(thisValue), 0); - auto argc = acc_.GetNumValueIn(gate); - for (size_t i = 1; i < argc; i++) { - GateRef arg = acc_.GetValueIn(gate, i); - acc_.ReplaceValueIn(gate, CheckAndConvertToInt32(arg, GateType::IntType()), i); - } - acc_.ReplaceStateIn(gate, builder_.GetState()); - acc_.ReplaceDependIn(gate, builder_.GetDepend()); - } - return Circuit::NullGate(); -} - GateRef NumberSpeculativeRetype::VisitMonoLoadPropertyOnProto(GateRef gate) { if (IsRetype()) { diff --git a/ecmascript/compiler/number_speculative_retype.h b/ecmascript/compiler/number_speculative_retype.h index fb77ac9c28..9a8293d6a3 100644 --- a/ecmascript/compiler/number_speculative_retype.h +++ b/ecmascript/compiler/number_speculative_retype.h @@ -137,7 +137,6 @@ private: GateRef VisitDateNow(GateRef gate); GateRef VisitArrayIncludesIndexOf(GateRef gate); GateRef VisitStringCharCodeAt(GateRef gate); - GateRef VisitString(GateRef gate); void ConvertForNumberBinaryOp(GateRef gate); void ConvertForNumberCompareOp(GateRef gate); diff --git a/ecmascript/compiler/typed_native_inline_lowering.cpp b/ecmascript/compiler/typed_native_inline_lowering.cpp index 1666bf22c3..9f8caa9b88 100644 --- a/ecmascript/compiler/typed_native_inline_lowering.cpp +++ b/ecmascript/compiler/typed_native_inline_lowering.cpp @@ -2140,13 +2140,7 @@ void TypedNativeInlineLowering::LowerStringSubstring(GateRef gate) GateRef thisValue = acc_.GetValueIn(gate, 0); // 0: the first parameter GateRef startTag = acc_.GetValueIn(gate, 1); // 1: the second parameter - auto argc = acc_.GetNumValueIn(gate); - GateRef endTag; - if (argc < 3) { // 3: the 2nd parameter of substring is optional - endTag = builder_.GetLengthFromString(thisValue); - } else { - endTag = acc_.GetValueIn(gate, 2); // 2: the third parameter - } + GateRef endTag = acc_.GetValueIn(gate, 2); // 2: the third parameter GateRef glue = glue_; DEFVALUE(result, (&builder_), VariableType::JS_POINTER(), builder_.Int32ToTaggedPtr(builder_.Int32(-1))); DEFVALUE(start, (&builder_), VariableType::INT32(), builder_.Int32(0)); @@ -2304,13 +2298,7 @@ void TypedNativeInlineLowering::LowerStringSlice(GateRef gate) GateRef thisValue = acc_.GetValueIn(gate, 0); // 0: the first parameter GateRef startTag = acc_.GetValueIn(gate, 1); // 1: the second parameter - auto argc = acc_.GetNumValueIn(gate); - GateRef endTag; - if (argc < 3) { // 3: the 2nd parameter of slice is optional - endTag = builder_.GetLengthFromString(thisValue); - } else { - endTag = acc_.GetValueIn(gate, 2); // 2: the third parameter - } + GateRef endTag = acc_.GetValueIn(gate, 2); // 2: the third parameter GateRef glue = glue_; DEFVALUE(result, (&builder_), VariableType::JS_POINTER(), builder_.Undefined()); DEFVALUE(start, (&builder_), VariableType::INT32(), builder_.Int32(0)); diff --git a/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp b/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp index 80890a9d59..8c8a843413 100644 --- a/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp +++ b/ecmascript/pgo_profiler/pgo_profiler_encoder.cpp @@ -14,14 +14,13 @@ */ #include "ecmascript/pgo_profiler/pgo_profiler_encoder.h" -#include "zlib.h" - #include "common_components/taskpool/taskpool.h" #include "ecmascript/pgo_profiler/pgo_profiler_manager.h" #include "ecmascript/pgo_profiler/pgo_trace.h" #include "ecmascript/platform/file.h" #include "ecmascript/platform/filesystem.h" #include "ecmascript/platform/os.h" +#include "zlib.h" namespace panda::ecmascript::pgo { bool PGOProfilerEncoder::Save(const std::shared_ptr pgoInfo) diff --git a/ecmascript/pgo_profiler/types/pgo_profile_type.cpp b/ecmascript/pgo_profiler/types/pgo_profile_type.cpp index 49236d6e61..906abc7622 100644 --- a/ecmascript/pgo_profiler/types/pgo_profile_type.cpp +++ b/ecmascript/pgo_profiler/types/pgo_profile_type.cpp @@ -70,12 +70,7 @@ std::optional ProfileType::CreateFromProfileTypeRef(PGOContext &con ProfileType &ProfileType::Remap([[maybe_unused]]const PGOContext &context) { if ((GetAbcId() >= PGOAbcFilePool::RESERVED_COUNT) && (!context.GetAbcIdRemap().empty())) { - if (GetAbcId() >= context.GetAbcIdRemap().size() + PGOAbcFilePool::RESERVED_COUNT) { - LOG_ECMA(ERROR) << "invalid abc id: " << GetAbcId() << ", " << GetTypeString() - << "remap size: " << context.GetAbcIdRemap().size(); - } else { - UpdateAbcId(context.GetAbcIdRemap().at(GetAbcId())); - } + UpdateAbcId(context.GetAbcIdRemap().at(GetAbcId())); } return *this; } diff --git a/ecmascript/pgo_profiler/types/pgo_profile_type.h b/ecmascript/pgo_profiler/types/pgo_profile_type.h index e5bf82dd4e..fa5c27cd97 100644 --- a/ecmascript/pgo_profiler/types/pgo_profile_type.h +++ b/ecmascript/pgo_profiler/types/pgo_profile_type.h @@ -64,7 +64,6 @@ public: }; static constexpr uint32_t RECORD_ID_FOR_BUNDLE = 1; - static constexpr uint32_t HUGE_ABC_ID = 500; static PUBLIC_API const ProfileType PROFILE_TYPE_NONE; @@ -395,9 +394,6 @@ public: void UpdateAbcId(ApEntityId abcId) { - if (abcId > HUGE_ABC_ID) { - LOG_ECMA(FATAL) << "huge abcId: " << abcId; // only for debug purpose, do not merge to release version - } type_ = AbcIdBits::Update(type_, abcId); } diff --git a/test/aottest/BUILD.gn b/test/aottest/BUILD.gn index fe676cefea..08f8ccbd1e 100644 --- a/test/aottest/BUILD.gn +++ b/test/aottest/BUILD.gn @@ -334,9 +334,6 @@ group("ark_aot_ts_test") { "string_equal", "string_inline", "string_localecompare", - "string_slice", - "string_sub_string", - "string_sub_str", "stsuperbyname", "sub", "supercall", diff --git a/test/aottest/string_slice/BUILD.gn b/test/aottest/string_slice/BUILD.gn deleted file mode 100644 index 2978fbdb44..0000000000 --- a/test/aottest/string_slice/BUILD.gn +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//arkcompiler/ets_runtime/test/test_helper.gni") - -host_aot_test_action("string_slice") { - deps = [] - is_enable_pgo = true - is_enable_enableArkTools = true - is_enable_opt_inlining = true - is_enable_native_inline = true -} diff --git a/test/aottest/string_slice/expect_output.txt b/test/aottest/string_slice/expect_output.txt deleted file mode 100644 index 8270899b28..0000000000 --- a/test/aottest/string_slice/expect_output.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -true -a diff --git a/test/aottest/string_slice/pgo_expect_output.txt b/test/aottest/string_slice/pgo_expect_output.txt deleted file mode 100644 index e0b3f928c3..0000000000 --- a/test/aottest/string_slice/pgo_expect_output.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -false -a diff --git a/test/aottest/string_slice/string_slice.ts b/test/aottest/string_slice/string_slice.ts deleted file mode 100644 index 7692a899d1..0000000000 --- a/test/aottest/string_slice/string_slice.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// @ts-nocheck -function foo() { - let a = "a"; - let b = a[0]; - let c = b.slice(0); - print(c); -} -print(ArkTools.isAOTCompiled(foo)); -foo(); diff --git a/test/aottest/string_sub_str/BUILD.gn b/test/aottest/string_sub_str/BUILD.gn deleted file mode 100644 index fad881d1d4..0000000000 --- a/test/aottest/string_sub_str/BUILD.gn +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//arkcompiler/ets_runtime/test/test_helper.gni") - -host_aot_test_action("string_sub_str") { - deps = [] - is_enable_pgo = true - is_enable_enableArkTools = true - is_enable_opt_inlining = true - is_enable_native_inline = true -} diff --git a/test/aottest/string_sub_str/expect_output.txt b/test/aottest/string_sub_str/expect_output.txt deleted file mode 100644 index 8270899b28..0000000000 --- a/test/aottest/string_sub_str/expect_output.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -true -a diff --git a/test/aottest/string_sub_str/pgo_expect_output.txt b/test/aottest/string_sub_str/pgo_expect_output.txt deleted file mode 100644 index e0b3f928c3..0000000000 --- a/test/aottest/string_sub_str/pgo_expect_output.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -false -a diff --git a/test/aottest/string_sub_str/string_sub_str.ts b/test/aottest/string_sub_str/string_sub_str.ts deleted file mode 100644 index 2aaff72ea9..0000000000 --- a/test/aottest/string_sub_str/string_sub_str.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// @ts-nocheck -function foo() { - let a = "a"; - let b = a[0]; - let c = b.substr(0); - print(c); -} -print(ArkTools.isAOTCompiled(foo)); -foo(); diff --git a/test/aottest/string_sub_string/BUILD.gn b/test/aottest/string_sub_string/BUILD.gn deleted file mode 100644 index 606f8e2de1..0000000000 --- a/test/aottest/string_sub_string/BUILD.gn +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//arkcompiler/ets_runtime/test/test_helper.gni") - -host_aot_test_action("string_sub_string") { - deps = [] - is_enable_pgo = true - is_enable_enableArkTools = true - is_enable_opt_inlining = true - is_enable_native_inline = true -} diff --git a/test/aottest/string_sub_string/expect_output.txt b/test/aottest/string_sub_string/expect_output.txt deleted file mode 100644 index 8270899b28..0000000000 --- a/test/aottest/string_sub_string/expect_output.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -true -a diff --git a/test/aottest/string_sub_string/pgo_expect_output.txt b/test/aottest/string_sub_string/pgo_expect_output.txt deleted file mode 100644 index e0b3f928c3..0000000000 --- a/test/aottest/string_sub_string/pgo_expect_output.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -false -a diff --git a/test/aottest/string_sub_string/string_sub_string.ts b/test/aottest/string_sub_string/string_sub_string.ts deleted file mode 100644 index 59d2f15ced..0000000000 --- a/test/aottest/string_sub_string/string_sub_string.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// @ts-nocheck -function foo() { - let a = "a"; - let b = a[0]; - let c = b.substring(0); - print(c); -} -print(ArkTools.isAOTCompiled(foo)); -foo(); -- Gitee