diff --git a/ecmascript/pgo_profiler/pgo_profiler.cpp b/ecmascript/pgo_profiler/pgo_profiler.cpp index ba68c4b4f62d590265d49d8c40fb2252029b1f77..6d5c576871d88175530ce54e347033100fe342c3 100644 --- a/ecmascript/pgo_profiler/pgo_profiler.cpp +++ b/ecmascript/pgo_profiler/pgo_profiler.cpp @@ -1313,8 +1313,13 @@ void PGOProfiler::DumpDefineClass(ApEntityId abcId, const CString &recordName, E if (IsSkippableObjectTypeSafe(localType)) { return; } - PGODefineOpType objDefType(localType); auto protoOrHClass = ctorFunction->GetProtoOrHClass(thread); + if (protoOrHClass.IsJSHClass() && + !JSHClass::Cast(protoOrHClass.GetTaggedObject())->IsOnlyJSObject()) { + return; + } + + PGODefineOpType objDefType(localType); if (protoOrHClass.IsJSHClass()) { auto ihc = JSHClass::Cast(protoOrHClass.GetTaggedObject()); SetRootProfileType(ihc, ctorAbcId, ctorMethodId, ProfileType::Kind::ClassId); diff --git a/test/aottest/BUILD.gn b/test/aottest/BUILD.gn index 156ce3dc17e937b806335179014efbb89785d248..e82408d6f637f1b0f12253b58e39197c3305b78f 100644 --- a/test/aottest/BUILD.gn +++ b/test/aottest/BUILD.gn @@ -389,6 +389,7 @@ group("ark_aot_ts_test") { "builtins_number", "builtins_number2", "builtins_parseint", + "builtins_proto", "constructor", "proxy_fast_call", "realm", diff --git a/test/aottest/builtins_proto/BUILD.gn b/test/aottest/builtins_proto/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..301ebbb7ece545e3bf0b1af45016b1be0a987f1c --- /dev/null +++ b/test/aottest/builtins_proto/BUILD.gn @@ -0,0 +1,21 @@ +# 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("builtins_proto") { + deps = [] + is_only_typed_path = true + is_enable_pgo = true + log_option = " --log-info=trace" +} diff --git a/test/aottest/builtins_proto/builtins_proto.ts b/test/aottest/builtins_proto/builtins_proto.ts new file mode 100644 index 0000000000000000000000000000000000000000..866f52b33281b55f3d417d78852f308efa618afd --- /dev/null +++ b/test/aottest/builtins_proto/builtins_proto.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ + +class A extends Promise {} +const v1 = new A(A) +const v2 = v1.catch() +v2.finally(Date) +A.__proto__ = Map \ No newline at end of file diff --git a/test/aottest/builtins_proto/expect_output.txt b/test/aottest/builtins_proto/expect_output.txt new file mode 100644 index 0000000000000000000000000000000000000000..13c57e2b6710dc72693a523acdf3fb99ce5cf309 --- /dev/null +++ b/test/aottest/builtins_proto/expect_output.txt @@ -0,0 +1,13 @@ +# 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. + diff --git a/test/aottest/builtins_proto/pgo_expect_output.txt b/test/aottest/builtins_proto/pgo_expect_output.txt new file mode 100644 index 0000000000000000000000000000000000000000..13c57e2b6710dc72693a523acdf3fb99ce5cf309 --- /dev/null +++ b/test/aottest/builtins_proto/pgo_expect_output.txt @@ -0,0 +1,13 @@ +# 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. +