!2109 Bug Fix of IC StoreMiss/LoadMiss

Merge pull request !2109 from DaiHN/icBugFix
This commit is contained in:
openharmony_ci 2022-08-25 07:33:19 +00:00 committed by Gitee
commit a28b465e98
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 114 additions and 3 deletions

View File

@ -137,7 +137,7 @@ void ICRuntime::TraceIC([[maybe_unused]] JSHandle<JSTaggedValue> receiver,
JSTaggedValue LoadICRuntime::LoadMiss(JSHandle<JSTaggedValue> receiver, JSHandle<JSTaggedValue> key)
{
if (receiver->IsTypedArray() || !receiver->IsJSObject() || receiver->IsSpecialContainer()) {
if (!receiver->IsJSObject() || receiver->HasOrdinaryGet()) {
icAccessor_.SetAsMega();
return JSTaggedValue::GetProperty(thread_, receiver, key).GetValue().GetTaggedValue();
}
@ -179,7 +179,7 @@ JSTaggedValue LoadICRuntime::LoadMiss(JSHandle<JSTaggedValue> receiver, JSHandle
JSTaggedValue StoreICRuntime::StoreMiss(JSHandle<JSTaggedValue> receiver, JSHandle<JSTaggedValue> key,
JSHandle<JSTaggedValue> value)
{
if (receiver->IsTypedArray() || !receiver->IsJSObject() || receiver->IsSpecialContainer()) {
if (!receiver->IsJSObject() || receiver->HasOrdinaryGet()) {
icAccessor_.SetAsMega();
bool success = JSTaggedValue::SetProperty(GetThread(), receiver, key, value, true);
return success ? JSTaggedValue::Undefined() : JSTaggedValue::Exception();

View File

@ -489,6 +489,11 @@ public:
return (JSType::JS_TYPED_ARRAY_FIRST < jsType && jsType <= JSType::JS_TYPED_ARRAY_LAST);
}
inline bool HasOrdinaryGet() const
{
return (IsTypedArray() || IsSpecialContainer() || IsModuleNamespace());
}
inline bool IsJSTypedArray() const
{
return GetObjectType() == JSType::JS_TYPED_ARRAY;

View File

@ -698,6 +698,11 @@ inline bool JSTaggedValue::IsSpecialContainer() const
return IsHeapObject() && GetTaggedObject()->GetClass()->IsSpecialContainer();
}
inline bool JSTaggedValue::HasOrdinaryGet() const
{
return IsHeapObject() && GetTaggedObject()->GetClass()->HasOrdinaryGet();
}
inline bool JSTaggedValue::IsPromiseIteratorRecord() const
{
return IsHeapObject() && GetTaggedObject()->GetClass()->IsPromiseIteratorRecord();

View File

@ -618,7 +618,7 @@ public:
bool IsJSAPIListIterator() const;
bool IsJSAPILinkedListIterator() const;
bool IsSpecialContainer() const;
bool HasOrdinaryGet() const;
bool IsPrototypeHandler() const;
bool IsTransitionHandler() const;
bool IsPropertyBox() const;

View File

@ -116,6 +116,10 @@ JSHandle<SourceTextModule> SourceTextModule::HostResolveImportedModule(JSThread
moduleFullname = baseFilename.substr(0, pos + 1) + moduleFilename.substr(0, suffixEnd) + ".abc";
}
#else
if (moduleFilename.find("./") == 0) {
moduleFilename = moduleFilename.substr(2); // 2 : delete './'
suffixEnd -=2; // 2 : delete './'
}
if (moduleFilename[0] == '/') { // absoluteFilePath
moduleFullname = moduleFilename.substr(0, suffixEnd) + ".abc";
} else {

View File

@ -36,6 +36,7 @@ group("ark_js_moduletest") {
"globalrecord:globalrecordAction",
"globalthis:globalthisAction",
"helloworld:helloworldAction",
"ldmodulensbyic:ldmodulensbyicAction",
"lexicalenv:lexicalenvAction",
"linkedhashtable:linkedhashtableAction",
"loadicbyvalue:loadicbyvalueAction",
@ -90,6 +91,7 @@ group("ark_asm_test") {
"globalrecord:globalrecordAsmAction",
"globalthis:globalthisAsmAction",
"helloworld:helloworldAsmAction",
"ldmodulensbyic:ldmodulensbyicAction",
"lexicalenv:lexicalenvAsmAction",
"linkedhashtable:linkedhashtableAsmAction",
"loadicbyvalue:loadicbyvalueAsmAction",
@ -141,6 +143,7 @@ group("ark_asm_single_step_test") {
"globalrecord:globalrecordAsmSingleStepAction",
"globalthis:globalthisAsmSingleStepAction",
"helloworld:helloworldAsmSingleStepAction",
"ldmodulensbyic:ldmodulensbyicAction",
"lexicalenv:lexicalenvAsmSingleStepAction",
"loadicbyvalue:loadicbyvalueAsmSingleStepAction",
"module:moduleAsmSingleStepAction",

View File

@ -0,0 +1,24 @@
# Copyright (c) 2021 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_moduletest_action("animals") {
deps = []
is_module = true
}
host_moduletest_action("ldmodulensbyic") {
deps = [ ":gen_animals_abc" ]
is_module = true
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2021 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.
*/
export let Panda = {
name : "panda"
}
export let Lion = {
name : "lion "
}
export let Monkey = {
name : "monkey"
}

View File

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

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021 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 * as animal from './animals.js';
let list = ["Panda", "Lion ", "Monkey"];
function printName(obj, index)
{
let name = obj[list[index]];
return name;
}
for(let i = 0; i< 500; ++i) {
for (let j = 0; j< 3; ++j) {
printName(animal, j);
}
}
print("success");