mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 04:00:37 +00:00
fix: parseInt is not correct handle exception
ParseInt is not correct handle exception after inlining Issue: #IB3O6D Signed-off-by: Like <zhenglike@huawei.com> Change-Id: Ib16471a3931be2fb4541460213c2e56bc66eeb99
This commit is contained in:
parent
d3b5af8fd7
commit
01f467af31
@ -684,8 +684,9 @@ void NativeInlineLowering::TryInlineNumberParseInt(GateRef gate, size_t argc, bo
|
||||
if (EnableTrace()) {
|
||||
AddTraceLogs(gate, id);
|
||||
}
|
||||
// this may return exception
|
||||
GateRef ret = builder_.NumberParseInt(arg, radix);
|
||||
acc_.ReplaceHirAndDeleteIfException(gate, builder_.GetStateDepend(), ret);
|
||||
acc_.ReplaceGate(gate, builder_.GetStateDepend(), ret);
|
||||
}
|
||||
|
||||
void NativeInlineLowering::TryInlineNumberIsSafeInteger(GateRef gate, size_t argc, bool skipThis)
|
||||
|
@ -1992,12 +1992,14 @@ void TypedNativeInlineLowering::LowerNumberParseInt(GateRef gate)
|
||||
builder_.Bind(&slowPath);
|
||||
{
|
||||
GateRef glue = acc_.GetGlueFromArgList();
|
||||
result = builder_.CallRuntime(glue, RTSTUB_ID(ParseInt), Gate::InvalidGateRef, { msg, arg2 }, gate);
|
||||
// this may return exception
|
||||
result = builder_.CallRuntime(glue, RTSTUB_ID(ParseInt), Gate::InvalidGateRef, {msg, arg2}, gate);
|
||||
builder_.Jump(&exit);
|
||||
}
|
||||
|
||||
builder_.Bind(&exit);
|
||||
acc_.ReplaceGate(gate, builder_.GetStateDepend(), *result);
|
||||
ReplaceGateWithPendingException(
|
||||
gate, acc_.GetGlueFromArgList(), builder_.GetState(), builder_.GetDepend(), *result);
|
||||
}
|
||||
|
||||
void TypedNativeInlineLowering::LowerNumberParseFloat(GateRef gate)
|
||||
|
@ -345,6 +345,7 @@ group("ark_aot_ts_test") {
|
||||
"sendablefunc",
|
||||
"sendablecontext",
|
||||
"createarraywithbuffer2",
|
||||
"createarraywithbuffer3",
|
||||
"builtins_number",
|
||||
"builtins_number2",
|
||||
"builtins_parseint",
|
||||
|
21
test/aottest/createarraywithbuffer3/BUILD.gn
Normal file
21
test/aottest/createarraywithbuffer3/BUILD.gn
Normal file
@ -0,0 +1,21 @@
|
||||
# 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("createarraywithbuffer3") {
|
||||
deps = []
|
||||
is_enable_pgo = true
|
||||
is_enable_opt_inlining = true
|
||||
is_enable_native_inline = true
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
declare function print(str: any): string;
|
||||
declare var ArkTools: any;
|
||||
function foo() {
|
||||
class a {
|
||||
toString() {
|
||||
// @ts-ignore
|
||||
new Proxy(undefined, {});
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
parseInt(new a());
|
||||
[0];
|
||||
}
|
||||
print(ArkTools.isAOTCompiled(foo));
|
||||
try {
|
||||
foo();
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
15
test/aottest/createarraywithbuffer3/expect_output.txt
Normal file
15
test/aottest/createarraywithbuffer3/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# 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.
|
||||
|
||||
true
|
||||
TypeError: ProxyCreate: target is not Object
|
15
test/aottest/createarraywithbuffer3/pgo_expect_output.txt
Normal file
15
test/aottest/createarraywithbuffer3/pgo_expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# 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.
|
||||
|
||||
false
|
||||
TypeError: ProxyCreate: target is not Object
|
@ -1249,7 +1249,7 @@ template("host_aot_js_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -1530,7 +1530,7 @@ template("host_aot_js_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -1804,7 +1804,7 @@ template("host_aot_js_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -2173,7 +2173,7 @@ template("host_aot_js_assert_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -2614,7 +2614,7 @@ template("host_aot_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -2708,7 +2708,7 @@ template("host_aot_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -3051,7 +3051,7 @@ template("host_aot_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -3147,7 +3147,7 @@ template("host_aot_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -3480,7 +3480,7 @@ template("host_aot_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -3578,7 +3578,7 @@ template("host_aot_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -4016,7 +4016,7 @@ template("host_aot_assert_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
@ -4110,7 +4110,7 @@ template("host_aot_assert_test_action") {
|
||||
|
||||
if (defined(invoker.is_enable_native_inline) &&
|
||||
invoker.is_enable_native_inline) {
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline"
|
||||
_aot_compile_options_ += " --compiler-enable-native-inline=true"
|
||||
}
|
||||
|
||||
if (defined(invoker.is_enable_opt_loop_peeling) &&
|
||||
|
Loading…
Reference in New Issue
Block a user