bugfix:bug in FastSuperAllocateThis,where newTarget should callruntime

issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I9PAFO

Signed-off-by: hecunmao <hecunmao@huawei.com>
Change-Id: Ief8218f84ea263398698583e0ee8751205678ac2
This commit is contained in:
hecunmao 2024-05-15 14:13:00 +08:00
parent 87c787bb4e
commit 9cc38e96c0
5 changed files with 74 additions and 1 deletions

View File

@ -1336,7 +1336,10 @@ GateRef NewObjectStubBuilder::FastSuperAllocateThis(GateRef glue, GateRef superC
Label checkJSObject(env);
Label callRuntime(env);
Label newObject(env);
Label isFunction(env);
BRANCH(IsJSFunction(newTarget), &isFunction, &callRuntime);
Bind(&isFunction);
DEFVARIABLE(thisObj, VariableType::JS_ANY(), Undefined());
DEFVARIABLE(protoOrHclass, VariableType::JS_ANY(), Undefined());
protoOrHclass = Load(VariableType::JS_ANY(), newTarget,

View File

@ -383,6 +383,7 @@ group("ark_asm_test") {
if (!is_debug) {
release_test_list = [
"asmstackoverflow",
"supercallRelease",
"multiconstpoolclass",
"multiconstpoolconstructor",
"multiconstpoolfunc",
@ -548,6 +549,7 @@ group("ark_asm_single_step_test") {
if (!is_debug) {
release_test_list = [
"asmstackoverflow",
"supercallRelease",
"multiconstpoolclass",
"multiconstpoolconstructor",
"multiconstpoolfunc",

View File

@ -0,0 +1,18 @@
# 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_moduletest_action("supercallRelease") {
deps = []
}

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.
super call test success!

View File

@ -0,0 +1,36 @@
/*
* 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.
*/
/*
* @tc.name:supercall
* @tc.desc:test supercall
* @tc.type: FUNC
*/
function f() {
function f1() {
}
class C4 extends f1 {
}
const v = new Proxy(C4, {});
new v();
f();
}
try {
f();
} catch (e) {
}
print("super call test success!");