Fix SIGSEGV in AddObjectInfo

Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IALDQE
Description
Add if statement, when GetReceiverObject is undefined,the process will not go to  function AddOnjectInfo

Signed-off-by: l00799755 <lujiahui4@huawei.com>
Change-Id: Ie7f455ad88aaaff2cc5d3bcb7afa23bb2fb4eed5
This commit is contained in:
l00799755 2024-08-23 21:12:50 +08:00
parent f972d1e20e
commit 92ffb6dff2
7 changed files with 76 additions and 3 deletions

View File

@ -85,9 +85,9 @@ public:
return GetReceiverObject() == other.GetReceiverObject() && GetHolderObject() == other.GetHolderObject(); return GetReceiverObject() == other.GetReceiverObject() && GetHolderObject() == other.GetHolderObject();
} }
bool IsHole() const bool IsValid() const
{ {
return GetReceiverObject().IsHole(); return !GetReceiverObject().IsHole() && !GetReceiverObject().IsUndefined();
} }
DECL_DUMP() DECL_DUMP()

View File

@ -557,7 +557,7 @@ void PGOProfiler::UpdateExtraProfileTypeInfo(ApEntityId abcId,
if (!key.IsUndefined() && !key.IsHole()) { if (!key.IsUndefined() && !key.IsHole()) {
JSTaggedValue val(dict->GetValue(hashIndex)); JSTaggedValue val(dict->GetValue(hashIndex));
ExtraProfileTypeInfo *extraInfo = ExtraProfileTypeInfo::Cast(val.GetTaggedObject()); ExtraProfileTypeInfo *extraInfo = ExtraProfileTypeInfo::Cast(val.GetTaggedObject());
if (extraInfo->IsHole()) { if (!extraInfo->IsValid()) {
continue; continue;
} }
AddObjectInfo(abcId, AddObjectInfo(abcId,

View File

@ -231,6 +231,7 @@ group("ark_aot_ts_test") {
"pgo_function_prototype", "pgo_function_prototype",
"pgo_gettersetter", "pgo_gettersetter",
"pgo_extrainfomap_expand", "pgo_extrainfomap_expand",
"pgo_extrainfomap_gc",
"pgo_inherited_function_operation", "pgo_inherited_function_operation",
"pgo_ldobjbyvalue_array", "pgo_ldobjbyvalue_array",
"pgo_ldobjbyvalue_string", "pgo_ldobjbyvalue_string",

View File

@ -0,0 +1,19 @@
# Copyright (c) 2024 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("pgo_extrainfomap_gc") {
deps = []
is_enable_pgo = true
}

View File

@ -0,0 +1,14 @@
# Copyright (c) 2024 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.
1

View File

@ -0,0 +1,14 @@
# Copyright (c) 2024 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.
1

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 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.
*/
function foo(a) {
const o = {
...a,
"p1": 1,
set p1(arg) {},
};
print(1);
}
foo({});