mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 16:13:49 +00:00
!2109 Bug Fix of IC StoreMiss/LoadMiss
Merge pull request !2109 from DaiHN/icBugFix
This commit is contained in:
commit
a28b465e98
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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",
|
||||
|
24
test/moduletest/ldmodulensbyic/BUILD.gn
Normal file
24
test/moduletest/ldmodulensbyic/BUILD.gn
Normal 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
|
||||
}
|
25
test/moduletest/ldmodulensbyic/animals.js
Normal file
25
test/moduletest/ldmodulensbyic/animals.js
Normal 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"
|
||||
}
|
14
test/moduletest/ldmodulensbyic/expect_output.txt
Normal file
14
test/moduletest/ldmodulensbyic/expect_output.txt
Normal 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
|
31
test/moduletest/ldmodulensbyic/ldmodulensbyic.js
Normal file
31
test/moduletest/ldmodulensbyic/ldmodulensbyic.js
Normal 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");
|
Loading…
Reference in New Issue
Block a user