diff --git a/BUILD.gn b/BUILD.gn
index 32901a7d010bdc1f659bba0546bd658aedbc8975..c5090b493ad23431fffccf29b488c60eeba8db17 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if (defined(ark_independent_build)) {
+if (defined(ark_standalone_build)) {
import("//js_runtime/js_runtime_config.gni")
import("$build_root/ark.gni")
} else {
@@ -39,7 +39,11 @@ if (defined(ark_independent_build)) {
group("ark_js_host_mac_tools_packages") {
deps = []
if (host_os == "mac") {
- deps += [ "//ark/js_runtime/ecmascript/js_vm:ark_js_vm(//build/toolchain/mac:clang_x64)" ]
+ if (host_cpu == "arm64") {
+ deps += [ "//ark/js_runtime/ecmascript/js_vm:ark_js_vm(//build/toolchain/mac:clang_arm64)" ]
+ } else {
+ deps += [ "//ark/js_runtime/ecmascript/js_vm:ark_js_vm(//build/toolchain/mac:clang_x64)" ]
+ }
}
}
@@ -52,7 +56,6 @@ if (defined(ark_independent_build)) {
deps += [
"//ark/js_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})",
"//ark/js_runtime/ecmascript/compiler:ark_stub_compiler(${host_toolchain})",
- "//ark/js_runtime/ecmascript/compiler:gen_stub_file(${host_toolchain})",
]
}
}
@@ -121,7 +124,6 @@ config("ark_jsruntime_public_config") {
"$ark_root/libpandafile:arkfile_public_config",
"$third_party_gn_path/icu/icu4c:icu_config",
sdk_libc_secshared_config,
- "$js_root/ecmascript/compiler:gen_stub_file_dir_config",
]
defines = []
@@ -137,7 +139,6 @@ config("ark_jsruntime_public_config") {
"$js_root",
# Dependent on runtime_core include
- "$ark_root/runtime",
"$ark_root",
]
}
@@ -184,7 +185,7 @@ config("ark_jsruntime_common_config") {
"-Wdate-time",
"-Wformat=2",
]
- if (defined(ark_independent_build)) {
+ if (defined(ark_standalone_build)) {
cflags_cc += [
"-std=c++17",
"-fno-rtti",
@@ -230,7 +231,7 @@ config("ark_jsruntime_common_config") {
}
}
- if (!defined(ark_independent_build)) {
+ if (!defined(ark_standalone_build)) {
if (!use_libfuzzer) {
cflags_cc += [ "-flto" ]
ldflags = [ "-flto" ]
@@ -348,6 +349,8 @@ ecma_source = [
"ecmascript/builtins/builtins_weak_set.cpp",
"ecmascript/containers/containers_arraylist.cpp",
"ecmascript/containers/containers_deque.cpp",
+ "ecmascript/containers/containers_lightweightmap.cpp",
+ "ecmascript/containers/containers_lightweightset.cpp",
"ecmascript/containers/containers_linked_list.cpp",
"ecmascript/containers/containers_list.cpp",
"ecmascript/containers/containers_plainarray.cpp",
@@ -364,8 +367,10 @@ ecma_source = [
"ecmascript/ecma_string.cpp",
"ecmascript/ecma_string_table.cpp",
"ecmascript/ecma_vm.cpp",
+ "ecmascript/frames.cpp",
"ecmascript/free_object.cpp",
"ecmascript/file_loader.cpp",
+ "ecmascript/llvm_stackmap_parser.cpp",
"ecmascript/generator_helper.cpp",
"ecmascript/global_env.cpp",
"ecmascript/global_env_constants.cpp",
@@ -395,6 +400,10 @@ ecma_source = [
"ecmascript/js_api_arraylist_iterator.cpp",
"ecmascript/js_api_deque.cpp",
"ecmascript/js_api_deque_iterator.cpp",
+ "ecmascript/js_api_lightweightmap.cpp",
+ "ecmascript/js_api_lightweightmap_iterator.cpp",
+ "ecmascript/js_api_lightweightset.cpp",
+ "ecmascript/js_api_lightweightset_iterator.cpp",
"ecmascript/js_api_linked_list.cpp",
"ecmascript/js_api_linked_list_iterator.cpp",
"ecmascript/js_api_list.cpp",
@@ -490,16 +499,15 @@ ecma_source = [
"ecmascript/template_string.cpp",
"ecmascript/waiter_list.cpp",
"ecmascript/weak_vector.cpp",
- "ecmascript/compiler/llvm/llvm_stackmap_parser.cpp",
"ecmascript/stubs/runtime_stubs.cpp",
"ecmascript/ts_types/ts_type.cpp",
"ecmascript/ts_types/ts_type_table.cpp",
"ecmascript/ts_types/ts_loader.cpp",
"ecmascript/ts_types/ts_obj_layout_info.cpp",
"ecmascript/stubs/test_runtime_stubs.cpp",
- "ecmascript/builtins/builtin_cjs_module.cpp",
- "ecmascript/builtins/builtin_cjs_require.cpp",
- "ecmascript/builtins/builtin_cjs_exports.cpp",
+ "ecmascript/builtins/builtins_cjs_module.cpp",
+ "ecmascript/builtins/builtins_cjs_require.cpp",
+ "ecmascript/builtins/builtins_cjs_exports.cpp",
"ecmascript/require/js_cjs_module_cache.cpp",
"ecmascript/require/js_cjs_module.cpp",
"ecmascript/require/js_require_manager.cpp",
@@ -510,6 +518,11 @@ if (!is_mingw && !is_mac) {
ecma_source += [ "ecmascript/tooling/interface/file_stream.cpp" ]
}
+hitrace_scope_source = []
+if (is_ohos && is_standard_system && enable_hitrace) {
+ hitrace_scope_source += [ "ecmascript/jobs/hitrace_scope.cpp" ]
+}
+
ecma_debugger_source = []
if (!is_mingw && !is_mac) {
ecma_debugger_source += [
@@ -541,6 +554,7 @@ source_set("libark_jsruntime_set") {
sources = ecma_source
sources += ecma_profiler_source
sources += ecma_debugger_source
+ sources += hitrace_scope_source
public_configs = [
"$js_root:ark_jsruntime_common_config",
@@ -575,10 +589,20 @@ source_set("libark_jsruntime_set") {
include_dirs += [ "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter" ]
cflags_cc += [ "-Wno-gnu-zero-variadic-macro-arguments" ]
}
+ if (enable_hitrace) {
+ defines += [ "ENABLE_HITRACE" ]
+ include_dirs +=
+ [ "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include" ]
+ }
if (enable_dump_in_faultlog) {
defines += [ "ENABLE_DUMP_IN_FAULTLOG" ]
include_dirs += [ "//base/hiviewdfx/faultloggerd/interfaces/innerkits/faultloggerd_client" ]
}
+ if (enable_hilog) {
+ defines += [ "ENABLE_HILOG" ]
+ include_dirs +=
+ [ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include" ]
+ }
}
}
@@ -613,6 +637,13 @@ source_set("libark_jsruntime_test_set") {
sdk_libc_secshared_dep,
]
+ if ((is_linux && current_cpu == "x64") ||
+ (is_ohos && current_cpu == "arm64")) {
+ deps += [ "$js_root/ecmascript/compiler:libark_stub_set" ]
+ } else {
+ deps += [ "$js_root/ecmascript/compiler:libark_mock_stub_set" ]
+ }
+
if (is_debug && is_linux && (current_cpu == "x86" || current_cpu == "x64") &&
run_with_asan) {
deps += [ ":copy_asan_runtime" ]
@@ -623,37 +654,52 @@ source_set("libark_jsruntime_test_set") {
"$js_root:ark_jsruntime_public_config",
]
}
-if (!defined(ark_independent_build)) {
- ohos_shared_library("libark_jsruntime") {
- deps = [
- ":libark_js_intl_set",
- ":libark_jsruntime_set",
- ]
- if (is_ohos && is_standard_system) {
- if (enable_dump_in_faultlog || enable_bytrace) {
- external_deps = []
- }
- if (enable_dump_in_faultlog) {
- external_deps += [ "faultloggerd:libfaultloggerd" ]
- }
- if (enable_bytrace) {
- external_deps += [ "hitrace_native:hitrace_meter" ]
- }
- }
+ohos_shared_library("libark_jsruntime") {
+ deps = [
+ ":libark_js_intl_set",
+ ":libark_jsruntime_set",
+ ]
- install_enable = true
+ if ((is_linux && current_cpu == "x64") ||
+ (is_ohos && current_cpu == "arm64")) {
+ deps += [ "$js_root/ecmascript/compiler:libark_stub_set" ]
+ } else {
+ deps += [ "$js_root/ecmascript/compiler:libark_mock_stub_set" ]
+ }
- if (!is_mingw && !is_mac) {
- output_extension = "so"
+ if (is_ohos && is_standard_system) {
+ if (enable_dump_in_faultlog || enable_bytrace || enable_hitrace ||
+ enable_hilog) {
+ external_deps = []
+ }
+ if (enable_dump_in_faultlog) {
+ external_deps += [ "faultloggerd:libfaultloggerd" ]
+ }
+ if (enable_bytrace) {
+ external_deps += [ "hitrace_native:hitrace_meter" ]
}
- if (!is_standard_system) {
- relative_install_dir = "ark"
+ if (enable_hitrace) {
+ external_deps += [ "hitrace_native:libhitrace" ]
}
- part_name = "ark_js_runtime"
- subsystem_name = "ark"
+ if (enable_hilog) {
+ external_deps += [ "hiviewdfx_hilog_native:libhilog" ]
+ }
+ }
+
+ install_enable = true
+
+ if (!is_mingw && !is_mac) {
+ output_extension = "so"
+ }
+ if (!is_standard_system) {
+ relative_install_dir = "ark"
}
+ part_name = "ark_js_runtime"
+ subsystem_name = "ark"
+}
+if (!defined(ark_standalone_build)) {
ohos_shared_library("libark_jsruntime_test") {
deps = [ ":libark_jsruntime_test_set" ]
@@ -671,14 +717,4 @@ if (!defined(ark_independent_build)) {
outputs = [ "${root_out_dir}/ark/ark_js_runtime/{{source_file_part}}" ]
}
}
-} else {
- ark_shared_library("libark_jsruntime") {
- deps = [
- ":libark_js_intl_set",
- ":libark_jsruntime_set",
- ]
- if (!is_mingw && !is_mac) {
- output_extension = "so"
- }
- }
}
diff --git a/README.md b/README.md
index 49559d09c7e5c1514ba66770a5c883ec39887af0..901b52c35fea885eb97e056830ba513a0eb924eb 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ For more information, see: [ARK Runtime Subsystem](https://gitee.com/openharmony
## Build
```
-./build.sh --product-name rk3568 --build-target ark_js_host_linux_tools_packages
+./build.sh --product-name hispark_taurus_standard --build-target ark_js_host_linux_tools_packages
```
### Available APIs
@@ -68,7 +68,7 @@ For details about how to generate JS bytecodes, see [Using the Toolchain](docs/
To run bytecodes:
```
-LD_LIBRARY_PATH=out/rk3568/clang_x64/ark/ark:out/rk3568/clang_x64/ark/ark_js_runtime:out/rk3568/clang_x64/thirdparty/icu:prebuilts/clang/ohos/linux-x86_64/llvm/lib ./out/rk3568/clang_x64/ark/ark_js_runtime/ark_js_vm helloworld.abc
+LD_LIBRARY_PATH=out/hispark_taurus/clang_x64/ark/ark:out/hispark_taurus/clang_x64/ark/ark_js_runtime:out/hispark_taurus/clang_x64/thirdparty/icu:prebuilts/clang/ohos/linux-x86_64/llvm/lib ./out/hispark_taurus/clang_x64/ark/ark_js_runtime/ark_js_vm helloworld.abc
```
For more information, please see: [ARK-Runtime-Usage-Guide](https://gitee.com/openharmony/ark_js_runtime/blob/master/docs/ARK-Runtime-Usage-Guide.md).
diff --git a/README_zh.md b/README_zh.md
index 3dce8938ba19c05da483587eb7151693c6f57f28..4b108eb476726045f18a1ff45bed746b26561515 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -57,7 +57,7 @@
## 编译构建
```
-$./build.sh --product-name rk3568 --build-target ark_js_host_linux_tools_packages
+$./build.sh --product-name hispark_taurus_standard --build-target ark_js_host_linux_tools_packages
```
### 接口说明
@@ -70,7 +70,7 @@ JS生成字节码参考[工具链使用](docs/using-the-toolchain-zh.md)
字节码执行:
```
-LD_LIBRARY_PATH=out/rk3568/clang_x64/ark/ark:out/rk3568/clang_x64/ark/ark_js_runtime:out/rk3568/clang_x64/thirdparty/icu:prebuilts/clang/ohos/linux-x86_64/llvm/lib ./out/rk3568/clang_x64/ark/ark_js_runtime/ark_js_vm helloworld.abc
+LD_LIBRARY_PATH=out/hispark_taurus/clang_x64/ark/ark:out/hispark_taurus/clang_x64/ark/ark_js_runtime:out/hispark_taurus/clang_x64/thirdparty/icu:prebuilts/clang/ohos/linux-x86_64/llvm/lib ./out/hispark_taurus/clang_x64/ark/ark_js_runtime/ark_js_vm helloworld.abc
```
diff --git a/build/README.md b/build/README.md
index 29550638384b7a599d633f7d1dcf3ab0fbc61f23..42ef943d28841dcdf9c35efb4a943ca508a34ac1 100644
--- a/build/README.md
+++ b/build/README.md
@@ -1,4 +1,5 @@
# ark_build
+注意:目前版本部分内容还需完善,后续入库后会做具体说明
#### 介绍
方舟独立编译构建build
@@ -16,18 +17,20 @@
├── ts2abc
-├── third_patry #从openharmony开源项目下载
+├── third_patry
+
+#所有仓库需从openharmony开源项目下载
#### 安装教程
-1. 独立编译拉取ark_js_runtime、ark_runtime_core、ark_ts2abc,执行./build/prebuilts_download.sh 下载相关的编译所需工具。
-2. 之后执行./js_runtime/build/compile_script/gen.sh ark将.gn、.sh文件拿出来。
+1. 独立编译拉取ark_js_runtime、ark_runtime_core、ark_ts2abc三个仓,执行[./build/prebuilts_download.sh] 下载相关的编译所需工具。
+2. 之后执行[./js_runtime/build/compile_script/gen.sh ark]将.gn与.sh文件拿出来。
3. 执行[./gen.sh]命令编译目前独立编译支持的所有目标,执行[./gen.sh abc]命令生成abc文件,执行[./gen.sh .]命令执行abc文件
#### 使用说明
-1. 独立编译build目录放在ark_js_runtime仓下
+1. 独立编译build目录放在ark_js_runtime仓下,它和build仓不一样,是独立编译特有的
2. 所需三方库从openharmony开源项目下载,包含 :
https://gitee.com/openharmony/third_party_bounds_checking_function,
https://gitee.com/openharmony/third_party_icu,
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index d142df1fad761a675f9f82dcdc7e00463ed1460e..da0814fc113fcdf4580a4cd32beb23d79dccbc79 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -12,8 +12,8 @@
# limitations under the License.
declare_args() {
- ark_independent_build = true
- root_core_gn = "//build/core/gn"
+ another_path = true
+ ark_standalone_build = true
build_root = "//js_runtime/build"
}
diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn
index fbcdc948d0db8b2f289e0fc9a4f4281ad8d7c70f..b30806d0d941ba187a39ca5204c7e157a1fbdc7e 100644
--- a/build/core/gn/BUILD.gn
+++ b/build/core/gn/BUILD.gn
@@ -27,7 +27,7 @@ print()
# /js_runtime/ecmascript/js_vm/BUILD.gn
-ark_executable("ark_js_vm") {
+ohos_executable("ark_js_vm") {
deps = [ "//js_runtime/ecmascript/js_vm:ark_js_vm_set" ]
ldflags = [
"-pie",
@@ -40,8 +40,20 @@ ark_executable("ark_js_vm") {
output_name = "ark_js_vm"
}
-ark_executable("ts2abc") {
- deps = [ "//ts2abc/ts2panda/ts2abc:ts2abc_static" ]
+enable_bytecode_optimizer = false
+ohos_executable("ts2abc") {
+ sources = [
+ "//ts2abc/ts2panda/ts2abc/main.cpp",
+ "//ts2abc/ts2panda/ts2abc/ts2abc.cpp",
+ ]
+
+ configs = [ "//ts2abc/ts2panda/ts2abc:ts2abc_config" ]
+
+ cflags = [
+ "-Wno-c++20-designator",
+ "-Wno-c99-extensions",
+ "-Wno-unknown-warning-option",
+ ]
ldflags = [
"-fPIE",
"-ldl",
@@ -50,6 +62,38 @@ ark_executable("ts2abc") {
"-lc++",
"-latomic",
]
+ deps = [ sdk_libc_secshared_dep ]
+
+ if (is_linux || is_mingw || is_mac) {
+ deps += [
+ "$ark_root/assembler:libarkassembler_frontend_static",
+ "$ark_root/libpandabase:libarkbase_frontend_static",
+ "$ark_root/libpandafile:libarkfile_frontend_static",
+ "$ark_root/libziparchive:libarkziparchive_frontend_static",
+ "$third_party_gn_path/jsoncpp:jsoncpp_static",
+ ]
+ if (enable_bytecode_optimizer) {
+ deps += [
+ "ark_root/bytecode_optimizer:libarkbytecodeopt_frontend_static",
+ "ark_root/compiler:libarkcompiler_frontend_static",
+ ]
+ }
+ } else {
+ deps += [
+ "$ark_root/assembler:libarkassembler",
+ "$ark_root/libpandabase:libarkbase",
+ "$ark_root/libpandafile:libarkfile",
+ "$ark_root/libziparchive:libarkziparchive",
+ "$third_party_gn_path/jsoncpp:jsoncpp",
+ ]
+ if (enable_bytecode_optimizer) {
+ deps += [
+ "$ark_root/bytecode_optimizer:libarkbytecodeopt",
+ "$ark_root/compiler:libarkcompiler",
+ ]
+ }
+ }
+
if (is_linux) {
if (build_public_version) {
ldflags += [ "-static-libstdc++" ]
@@ -57,6 +101,7 @@ ark_executable("ts2abc") {
libs = [ libcpp_static_lib ]
}
}
+
output_dir = "${root_out_dir}/ark/ark/"
output_name = "js2abc"
}
@@ -65,18 +110,18 @@ ark_executable("ts2abc") {
src_dir = target_out_dir + "/src"
-ark_copy("ts2abc_src") {
+ohos_copy("ts2abc_src") {
sources = [ "${ts2abc_root}/src" ]
outputs = [ src_dir ]
}
-ark_copy("node_modules") {
+ohos_copy("node_modules") {
sources = [ rebase_path("${node_modules}") ]
print("sources=$sources")
outputs = [ target_out_dir + "/node_modules" ]
}
-ark_copy("config_files") {
+ohos_copy("config_files") {
sources = [
"${ts2abc_root}/package-lock.json",
"${ts2abc_root}/package.json",
@@ -188,13 +233,13 @@ action("npm_run_build") {
}
}
-ark_copy("ts2abc_build") {
+ohos_copy("ts2abc_build") {
deps = [ ":npm_run_build" ]
sources = [ "${root_out_dir}/ark/ark/build" ]
outputs = [ "${target_out_dir}/build-tmp" ]
}
-ark_copy("ts2abc_build_ets") {
+ohos_copy("ts2abc_build_ets") {
deps = [ ":npm_run_build" ]
sources = [ "${root_out_dir}/ark/ark/build" ]
outputs = [ "${root_out_dir}/ark/ark/build-ets" ]
diff --git a/build/prebuilts_download.sh b/build/prebuilts_download.sh
index 4a6b8e2ed4ea1c8aab88d1c1d38ae0e54751f8b9..a0465298a8e6be23c839afeff98b45f29af2dc64 100755
--- a/build/prebuilts_download.sh
+++ b/build/prebuilts_download.sh
@@ -1,10 +1,10 @@
#!/bin/bash
-# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Copyright (c) 2021-2022 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
+# 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,
@@ -14,12 +14,13 @@
set -e
for i in "$@"; do
case "$i" in
- -skip-ssl|--skip-ssl) # wget、npm跳过ssl检查,如使用此参数:
- # 黑客等不法分子可以篡改或窃取客户端和服务器之间传输的信息和数据,从而影响用户的数据安全!
+ -skip-ssl|--skip-ssl) # wget、npm skip ssl check, which will allow
+ # hacker to get and modify data stream between server and client!
SKIP_SSL=YES
;;
esac
done
+
if [ "X${SKIP_SSL}" == "XYES" ];then
wget_ssl_check='--no-check-certificate'
else
@@ -43,12 +44,13 @@ echo "npm_registry=$npm_registry"
sha256_result=0
check_sha256=''
local_sha256=''
-function check_sha256(){
+
+function check_sha256() {
success_color='\033[1;42mSuccess\033[0m'
failed_color='\033[1;41mFailed\033[0m'
- check_url=$1 #来源URL
- local_file=$2 #本地文件绝对路径
- check_sha256=$(curl -s -k ${check_url}.sha256) # 当前使用华为云,URL固定,所以写死了,后续如果有变动,此处需要修改
+ check_url=$1 # source URL
+ local_file=$2 # local absolute path
+ check_sha256=$(curl -s -k ${check_url}.sha256)
local_sha256=$(sha256sum ${local_file} |awk '{print $1}')
if [ "X${check_sha256}" == "X${local_sha256}" ];then
echo -e "${success_color},${check_url} Sha256 check OK."
@@ -56,13 +58,28 @@ function check_sha256(){
else
echo -e "${failed_color},${check_url} Sha256 check Failed.Retry!"
sha256_result=1
- #exit 1 # 默认退出,必须保证sha256一致,如有特殊需要,请自行注释
fi
}
-function hwcloud_download(){
- # 代理不需要鉴权: wget -t3 -T10 -O ${bin_dir} -e "https_proxy=http://domain.com:port" ${huaweicloud_url}
- # 代理需要鉴权(账号密码特殊字符均需要URL转义): wget -t3 -T10 -O ${bin_dir} -e "https_proxy=http://username:password@domain.com:port" ${huaweicloud_url}
- # 不需要代理
+
+function check_sha256_by_mark() {
+ success_color='\033[1;42mSuccess\033[0m'
+ check_url=$1 # source URL
+ check_sha256=$(curl -s -k ${check_url}.sha256)
+ echo $1
+ if [ -f "${code_dir}/${unzip_dir}/${check_sha256}.mark" ];then
+ echo -e "${success_color},${check_url} Sha256 markword check OK."
+ sha256_result=0
+ else
+ echo -e "${check_url} Sha256 mismatch or files not downloaded yet."
+ sha256_result=1
+ fi
+}
+
+function hwcloud_download() {
+ # when proxy certfication not required : wget -t3 -T10 -O ${bin_dir} -e "https_proxy=http://domain.com:port" ${huaweicloud_url}
+ # when proxy certfication required (special char need URL translate, e.g '!' -> '%21'git
+ # wget -t3 -T10 -O ${bin_dir} -e "https_proxy=http://username:password@domain.com:port" ${huaweicloud_url}
+
download_local_file=$1
download_source_url=$2
for((i=1;i<=3;i++));
@@ -70,10 +87,8 @@ function hwcloud_download(){
if [ -f "${download_local_file}" ];then
check_sha256 "${download_source_url}" "${download_local_file}"
if [ ${sha256_result} -gt 0 ];then
- # 设置变量默认值,防止误删除
rm -rf "${download_local_file:-/tmp/20210721_not_exit_file}"
else
- i=999
return 0
fi
fi
@@ -81,7 +96,7 @@ function hwcloud_download(){
wget -t3 -T10 ${wget_ssl_check} -O "${download_local_file}" "${download_source_url}"
fi
done
- # 连续三次失败后报错退出
+ # three times error, exit
echo -e """Sha256 check failed!
Download URL: ${download_source_url}
Local file: ${download_local_file}
@@ -90,6 +105,37 @@ Local sha256: ${local_sha256}"""
exit 1
}
+function npm_install() {
+ full_code_path=${code_dir}/$1
+ if [ ! -d ${full_code_path} ]; then
+ echo "${full_code_path} not exist, it shouldn't happen, pls check..."
+ else
+ cd ${full_code_path}
+ export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH
+ npm config set registry ${npm_registry}
+ if [ "X${SKIP_SSL}" == "XYES" ];then
+ npm config set strict-ssl false
+ fi
+ # npm cache clean -f
+ npm install
+ fi
+}
+
+function node_modules_copy() {
+ full_code_path=${code_dir}/$1
+ tool_path=$2
+ if [ -d "${full_code_path}" ] & [ ! -z ${tool_path} ]; then
+ if [ -d "${code_dir}/${tool_path}" ]; then
+ echo -e "\n"
+ echo "${code_dir}/${tool_path} already exist, it will be replaced with node-${node_js_ver}"
+ /bin/rm -rf ${code_dir}/${tool_path}
+ echo -e "\n"
+ fi
+ mkdir -p ${code_dir}/${tool_path}
+ /bin/cp -R ${full_code_path}/node_modules ${code_dir}/${tool_path}
+ fi
+}
+
case $(uname -s) in
Linux)
host_platform=linux
@@ -102,45 +148,41 @@ case $(uname -s) in
exit 1
esac
-# 代码下载目录
+# sync code directory
script_path=$(cd $(dirname $0);pwd)
-code_dir=$(dirname ${script_path})
-# 二进制所在目录,用于临时存放二进制,需要约7G空间
-# 下载的压缩包会自动解压到代码目录,压缩包会一直保留在该目录下
-bin_dir=${code_dir}/../OpenHarmony_2.0_canary_prebuilts
+code_dir=$(dirname ${script_path})/..
+# "prebuilts" directory will be generated under project root which is used to saved binary (arround 9.5GB)
+# downloaded files will be automatically unziped under this path
+bin_dir=${code_dir}/OpenHarmony_2.0_canary_prebuilts
+
+# download file list
+# todo: add product related config
-# 二进制关系
copy_config="""
-prebuilts/sdk/js-loader/build-tools,${tool_repo}/harmonyos/compiler/ace-loader/1.0/ace-loader-1.0.tar.gz
-prebuilts/build-tools/common,${tool_repo}/harmonyos/compiler/restool/2.007/restool-2.007.tar.gz
-prebuilts/cmake,${tool_repo}/harmonyos/compiler/cmake/3.16.5/${host_platform}/cmake-${host_platform}-x86-3.16.5.tar.gz
-prebuilts/build-tools/${host_platform}-x86/bin,${tool_repo}/harmonyos/compiler/gn/1717/${host_platform}/gn-${host_platform}-x86-1717.tar.gz
-prebuilts/build-tools/${host_platform}-x86/bin,${tool_repo}/harmonyos/compiler/ninja/1.10.1/${host_platform}/ninja-${host_platform}-x86-1.10.1.tar.gz
-prebuilts/python,${tool_repo}/harmonyos/compiler/python/3.8.5/${host_platform}/python-${host_platform}-x86-3.8.5.tar.gz
-prebuilts/clang/ohos/${host_platform}-x86_64,${tool_repo}/harmonyos/compiler/clang/10.0.1-480513/${host_platform}/clang-480513-${host_platform}-x86_64.tar.bz2
-prebuilts/,${tool_repo}/harmonyos/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220301.tar.gz
+prebuilts/build-tools/common,${tool_repo}/openharmony/compiler/restool/2.007/restool-2.007.tar.gz
+prebuilts/build-tools/${host_platform}-x86/bin,${tool_repo}/openharmony/compiler/gn/1717/${host_platform}/gn-${host_platform}-x86-1717.tar.gz
+prebuilts/build-tools/${host_platform}-x86/bin,${tool_repo}/openharmony/compiler/ninja/1.10.1/${host_platform}/ninja-${host_platform}-x86-1.10.1.tar.gz
+prebuilts/clang/ohos/${host_platform}-x86_64,${tool_repo}/openharmony/compiler/clang/10.0.1-480513/${host_platform}/clang-480513-${host_platform}-x86_64.tar.bz2
+prebuilts/ark_tools,${tool_repo}/openharmony/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220425.tar.gz
+"""
+
+linux_copy_config="""
+prebuilts/clang/ohos/${host_platform}-x86_64,${tool_repo}/openharmony/compiler/clang/10.0.1-480513/${host_platform}/libcxx-ndk-480513-${host_platform}-x86_64.tar.bz2
+"""
+
+darwin_copy_config="""
+prebuilts/previewer/darwin,${tool_repo}/openharmony/develop_tools/previewer/3.1.5.6/previewer-3.1.5.6.mac.tar.gz
+prebuilts/clang/ohos/${host_platform}-x86_64,${tool_repo}/openharmony/compiler/clang/10.0.1-480513/${host_platform}/libcxx-ndk-480513-${host_platform}-x86_64.tar.bz2
+prebuilts/python,${tool_repo}/openharmony/compiler/python/3.9.2/${host_platform}/python-${host_platform}-x86-3.9.2_202205071615.tar.gz
"""
if [[ "${host_platform}" == "linux" ]]; then
- copy_config+="""
- prebuilts/cmake,${tool_repo}/harmonyos/compiler/cmake/3.16.5/windows/cmake-windows-x86-3.16.5.tar.gz
- prebuilts/mingw-w64/ohos/linux-x86_64,${tool_repo}/harmonyos/compiler/mingw-w64/7.0.0/clang-mingw.tar.gz
- prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi,${tool_repo}/harmonyos/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi.tar.gz
- prebuilts/gcc/linux-x86/aarch64,${tool_repo}/harmonyos/compiler/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi/1.0/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
- prebuilts/previewer/windows,${tool_repo}/harmonyos/develop_tools/previewer/3.1.5.4/previewer-3.1.5.4.win.tar.gz
- prebuilts/clang/ohos/windows-x86_64,${tool_repo}/harmonyos/compiler/clang/10.0.1-480513/windows/clang-480513-windows-x86_64.tar.bz2
- prebuilts/clang/ohos/windows-x86_64,${tool_repo}/harmonyos/compiler/clang/10.0.1-480513/windows/libcxx-ndk-480513-windows-x86_64.tar.bz2
- prebuilts/clang/ohos/${host_platform}-x86_64,${tool_repo}/harmonyos/compiler/clang/10.0.1-480513/${host_platform}/libcxx-ndk-480513-${host_platform}-x86_64.tar.bz2
- prebuilts/gcc/linux-x86/esp,${tool_repo}/harmonyos/compiler/gcc_esp/2019r2-8.2.0/linux/esp-2019r2-8.2.0.zip
- prebuilts/gcc/linux-x86/csky,${tool_repo}/harmonyos/compiler/gcc_csky/v3.10.29/linux/csky-v3.10.29.tar.gz
- """
+ copy_config+=${linux_copy_config}
elif [[ "${host_platform}" == "darwin" ]]; then
- copy_config+="""
- prebuilts/previewer/darwin,${tool_repo}/harmonyos/develop_tools/previewer/3.1.5.4/previewer-3.1.5.4.mac.tar.gz
- prebuilts/clang/ohos/${host_platform}-x86_64,${tool_repo}/harmonyos/compiler/clang/10.0.1-480513/${host_platform}/libcxx-ndk-480513-${host_platform}-x86_64.tar.bz2
- """
+ copy_config+=${darwin_copy_config}
fi
+# download and initialize prebuild files
if [ ! -d "${bin_dir}" ];then
mkdir -p "${bin_dir}"
fi
@@ -157,41 +199,50 @@ do
if [ ! -d "${code_dir}/${unzip_dir}" ];then
mkdir -p "${code_dir}/${unzip_dir}"
fi
- hwcloud_download "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" "${huaweicloud_url}"
- if [ "X${bin_file_suffix:0-3}" = "Xzip" ];then
- unzip -o "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" -d "${code_dir}/${unzip_dir}/"
- elif [ "X${bin_file_suffix:0-6}" = "Xtar.gz" ];then
- tar -xvzf "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" -C "${code_dir}/${unzip_dir}"
- else
- tar -xvf "${bin_dir}/${md5_huaweicloud_url}.${bin_file_suffix}" -C "${code_dir}/${unzip_dir}"
- fi
- # 由于部分压缩包包含了目录,用于专门处理多余目录
- if [ -d "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi" ];then
- mv "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi" "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi2/"
- rm -rf "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi"
- mv "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi2/" "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/"
- fi
- if [ -d "${code_dir}/prebuilts/clang/ohos/windows-x86_64/clang-480513" ];then
- rm -rf "${code_dir}/prebuilts/clang/ohos/windows-x86_64/llvm"
- mv "${code_dir}/prebuilts/clang/ohos/windows-x86_64/clang-480513" "${code_dir}/prebuilts/clang/ohos/windows-x86_64/llvm"
- ln -snf 10.0.1 "${code_dir}/prebuilts/clang/ohos/windows-x86_64/llvm/lib/clang/current"
- fi
- if [ -d "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-480513" ];then
- rm -rf "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm"
- mv "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-480513" "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm"
- ln -snf 10.0.1 "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current"
- fi
- if [ -d "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang-480513" ];then
- rm -rf "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/llvm"
- mv "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang-480513" "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/llvm"
- ln -snf 10.0.1 "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/llvm/lib/clang/current"
- fi
- if [ -d "${code_dir}/prebuilts/gcc/linux-x86/esp/esp-2019r2-8.2.0/xtensa-esp32-elf" ];then
- chmod 755 "${code_dir}/prebuilts/gcc/linux-x86/esp/esp-2019r2-8.2.0" -R
+
+ check_sha256_by_mark ${huaweicloud_url}
+ if [ ${sha256_result} -gt 0 ]; then
+ hwcloud_download "${bin_dir}/${md5_huaweicloud_url}.${bin_file}" "${huaweicloud_url}"
+ if [ "X${bin_file:0-3}" = "Xzip" ];then
+ unzip -o "${bin_dir}/${md5_huaweicloud_url}.${bin_file}" -d "${code_dir}/${unzip_dir}/"
+ elif [ "X${bin_file:0-6}" = "Xtar.gz" ];then
+ tar -xvzf "${bin_dir}/${md5_huaweicloud_url}.${bin_file}" -C "${code_dir}/${unzip_dir}"
+ else
+ tar -xvf "${bin_dir}/${md5_huaweicloud_url}.${bin_file}" -C "${code_dir}/${unzip_dir}"
+ fi
+ # it is used to handle some redundant files under prebuilts path
+ # todo: remove redundant files before prebuilts_download
+ if [ -d "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi" ];then
+ mv "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/prebuilts_gcc_linux-x86_arm_gcc-linaro-7.5.0-arm-linux-gnueabi" "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi2/"
+ rm -rf "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi"
+ mv "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi2/" "${code_dir}/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/"
+ fi
+ if [ -d "${code_dir}/prebuilts/clang/ohos/windows-x86_64/clang-480513" ];then
+ rm -rf "${code_dir}/prebuilts/clang/ohos/windows-x86_64/llvm"
+ mv "${code_dir}/prebuilts/clang/ohos/windows-x86_64/clang-480513" "${code_dir}/prebuilts/clang/ohos/windows-x86_64/llvm"
+ ln -snf 10.0.1 "${code_dir}/prebuilts/clang/ohos/windows-x86_64/llvm/lib/clang/current"
+ fi
+ if [ -d "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-480513" ];then
+ rm -rf "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm"
+ mv "${code_dir}/prebuilts/clang/ohos/linux-x86_64/clang-480513" "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm"
+ ln -snf 10.0.1 "${code_dir}/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current"
+ fi
+ if [ -d "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang-480513" ];then
+ rm -rf "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/llvm"
+ mv "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/clang-480513" "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/llvm"
+ ln -snf 10.0.1 "${code_dir}/prebuilts/clang/ohos/darwin-x86_64/llvm/lib/clang/current"
+ fi
+ if [ -d "${code_dir}/prebuilts/gcc/linux-x86/esp/esp-2019r2-8.2.0/xtensa-esp32-elf" ];then
+ chmod 755 "${code_dir}/prebuilts/gcc/linux-x86/esp/esp-2019r2-8.2.0" -R
+ fi
+ echo 0 > "${code_dir}/${unzip_dir}/${check_sha256}.mark"
fi
+ echo "k"
done
+# npm env setup and install
+
node_js_ver=v12.18.4
node_js_name=node-${node_js_ver}-${host_platform}-x64
node_js_pkg=${node_js_name}.tar.gz
@@ -202,80 +253,19 @@ if [ ! -f "${node_js_pkg}" ]; then
tar zxf ${node_js_pkg}
fi
-if [ ! -d "${code_dir}/third_party/jsframework" ]; then
- echo "${code_dir}/third_party/jsframework not exist, it shouldn't happen, pls check..."
-else
- cd ${code_dir}/third_party/jsframework/
- export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH
- npm config set registry ${npm_registry}
- if [ "X${SKIP_SSL}" == "XYES" ];then
- npm config set strict-ssl false
- fi
- npm cache clean -f
- npm install
-
- cd ${code_dir}
- if [ -d "${code_dir}/prebuilts/build-tools/common/js-framework" ]; then
- echo -e "\n"
- echo "${code_dir}/prebuilts/build-tools/common/js-framework already exist, it will be replaced with node-${node_js_ver}"
- /bin/rm -rf ${code_dir}/prebuilts/build-tools/common/js-framework
- echo -e "\n"
- fi
-
- mkdir -p ${code_dir}/prebuilts/build-tools/common/js-framework
- /bin/cp -R ${code_dir}/third_party/jsframework/node_modules ${code_dir}/prebuilts/build-tools/common/js-framework/
-fi
-
-if [ ! -d "${code_dir}/developtools/ace-ets2bundle/compiler" ]; then
- echo "${code_dir}/developtools/ace-ets2bundle/compiler not exist, it shouldn't happen, pls check..."
-else
- cd ${code_dir}/developtools/ace-ets2bundle/compiler
- export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH
- npm config set registry ${npm_registry}
- if [ "X${SKIP_SSL}" == "XYES" ];then
- npm config set strict-ssl false
- fi
- npm cache clean -f
- npm install
-fi
-
-
-if [ ! -d "${code_dir}/developtools/ace-js2bundle/ace-loader" ]; then
- echo "${code_dir}/developtools/ace-js2bundle/ace-loader not exist, it shouldn't happen, pls check..."
-else
- cd ${code_dir}/developtools/ace-js2bundle/ace-loader
- export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH
- npm config set registry ${npm_registry}
- if [ "X${SKIP_SSL}" == "XYES" ];then
- npm config set strict-ssl false
- fi
- npm cache clean -f
- npm install
-fi
-
-
-if [ -d "${code_dir}/ark/ts2abc/ts2panda" ]; then
- cd ${code_dir}/ark/ts2abc/ts2panda
- export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH
- npm config set registry ${npm_registry}
- if [ "X${SKIP_SSL}" == "XYES" ];then
- npm config set strict-ssl false
- fi
- npm cache clean -f
- npm install
-
- cd ${code_dir}
- if [ -d "${code_dir}/prebuilts/build-tools/common/ts2abc" ]; then
- echo -e "\n"
- echo "${code_dir}/prebuilts/build-tools/common/ts2abc already exist, it will be replaced with node-${node_js_ver}"
- /bin/rm -rf ${code_dir}/prebuilts/build-tools/common/ts2abc
- echo -e "\n"
- fi
-
- mkdir -p ${code_dir}/prebuilts/build-tools/common/ts2abc
- /bin/cp -rf ${code_dir}/ark/ts2abc/ts2panda/node_modules ${code_dir}/prebuilts/build-tools/common/ts2abc/
-fi
+npm_install_config="""
+ts2abc/ts2panda,prebuilts/build-tools/common/ts2abc
+"""
+for i in $(echo ${npm_install_config})
+do
+ code_path=$(echo $i|awk -F ',' '{print $1}')
+ modules_path=$(echo $i|awk -F ',' '{print $2}')
+ npm_install ${code_path}
+ echo ${code_path}
+ echo ${modules_path}
+ node_modules_copy ${code_path} ${modules_path}
+done
cd ${code_dir}
echo -e "\n"
diff --git a/build/templates/cxx/cxx.gni b/build/templates/cxx/cxx.gni
index e7d6b61197e3d202892f812a5a91429bd53e5101..f060706bf83e56c0f228a7caecea8f87a02d8aac 100755
--- a/build/templates/cxx/cxx.gni
+++ b/build/templates/cxx/cxx.gni
@@ -11,22 +11,42 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-template("ark_executable") {
+template("ohos_executable") {
executable(target_name) {
- forward_variables_from(invoker, "*")
+ forward_variables_from(invoker,
+ "*",
+ [
+ "subsystem_name",
+ "install_enable",
+ ])
}
}
-template("ark_static_library") {
+template("ohos_static_library") {
static_library(target_name) {
- forward_variables_from(invoker, "*")
+ forward_variables_from(invoker,
+ "*",
+ [
+ "subsystem_name",
+ "part_name",
+ "use_exceptions",
+ ])
}
}
-template("ark_shared_library") {
+template("ohos_shared_library") {
shared_library(target_name) {
- forward_variables_from(invoker, "*")
+ forward_variables_from(invoker,
+ "*",
+ [
+ "relative_install_dir",
+ "subsystem_name",
+ "install_enable",
+ "part_name",
+ "use_exceptions",
+ ])
}
}
-template("ark_copy") {
+
+template("ohos_copy") {
copy(target_name) {
forward_variables_from(invoker, "*")
}
diff --git a/build/third_party_gn/icu/icu4c/BUILD.gn b/build/third_party_gn/icu/icu4c/BUILD.gn
deleted file mode 100644
index 198fd94cd6005fa2a04ce2570c3751692e9f66b8..0000000000000000000000000000000000000000
--- a/build/third_party_gn/icu/icu4c/BUILD.gn
+++ /dev/null
@@ -1,659 +0,0 @@
-# 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("$build_root/ark.gni")
-config("icu_config") {
- visibility = [ ":*" ]
- include_dirs = [
- "//third_party/icu/icu4c/source/common",
- "//third_party/icu/icu4c/source/i18n",
- "//third_party/icu/icu4c/source",
- ]
- cflags_cc = [ "-fPIC" ]
-}
-
-ark_static_library("static_icustubdata") {
- configs = [
- ":icu_config",
- "$build_root/config/compiler:rtti",
- ]
- sources = [ "//third_party/icu/icu4c/source/stubdata/stubdata.cpp" ]
-
- cflags_cc = [
- "-O3",
- "-W",
- "-Wall",
- "-pedantic",
- "-Wpointer-arith",
- "-Wwrite-strings",
- "-std=c++11",
- "-Wno-ignored-attributes",
- ]
- output_dir = "${root_out_dir}/third_party/icu/stubdata"
- output_name = "stubdata"
-}
-
-icu_common_source = [
- "//third_party/icu/icu4c/source/common/ubiditransform.cpp",
- "//third_party/icu/icu4c/source/common/locutil.cpp",
- "//third_party/icu/icu4c/source/common/cstring.cpp",
- "//third_party/icu/icu4c/source/common/rbbiscan.cpp",
- "//third_party/icu/icu4c/source/common/utrie.cpp",
- "//third_party/icu/icu4c/source/common/cwchar.cpp",
- "//third_party/icu/icu4c/source/common/bytestriebuilder.cpp",
- "//third_party/icu/icu4c/source/common/umapfile.cpp",
- "//third_party/icu/icu4c/source/common/uenum.cpp",
- "//third_party/icu/icu4c/source/common/putil.cpp",
- "//third_party/icu/icu4c/source/common/bytestrieiterator.cpp",
- "//third_party/icu/icu4c/source/common/unifunct.cpp",
- "//third_party/icu/icu4c/source/common/rbbistbl.cpp",
- "//third_party/icu/icu4c/source/common/bytestrie.cpp",
- "//third_party/icu/icu4c/source/common/ucptrie.cpp",
- "//third_party/icu/icu4c/source/common/errorcode.cpp",
- "//third_party/icu/icu4c/source/common/unames.cpp",
- "//third_party/icu/icu4c/source/common/restrace.cpp",
- "//third_party/icu/icu4c/source/common/util.cpp",
- "//third_party/icu/icu4c/source/common/sharedobject.cpp",
- "//third_party/icu/icu4c/source/common/bmpset.cpp",
- "//third_party/icu/icu4c/source/common/servlk.cpp",
- "//third_party/icu/icu4c/source/common/ustrcase_locale.cpp",
- "//third_party/icu/icu4c/source/common/localeprioritylist.cpp",
- "//third_party/icu/icu4c/source/common/ucnvbocu.cpp",
- "//third_party/icu/icu4c/source/common/ucharstrieiterator.cpp",
- "//third_party/icu/icu4c/source/common/unisetspan.cpp",
- "//third_party/icu/icu4c/source/common/locavailable.cpp",
- "//third_party/icu/icu4c/source/common/unistr.cpp",
- "//third_party/icu/icu4c/source/common/ustr_wcs.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_err.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_lmb.cpp",
- "//third_party/icu/icu4c/source/common/rbbidata.cpp",
- "//third_party/icu/icu4c/source/common/uarrsort.cpp",
- "//third_party/icu/icu4c/source/common/ucnv2022.cpp",
- "//third_party/icu/icu4c/source/common/uresbund.cpp",
- "//third_party/icu/icu4c/source/common/ucnvsel.cpp",
- "//third_party/icu/icu4c/source/common/unistr_titlecase_brkiter.cpp",
- "//third_party/icu/icu4c/source/common/loadednormalizer2impl.cpp",
- "//third_party/icu/icu4c/source/common/ustring.cpp",
- "//third_party/icu/icu4c/source/common/unifilt.cpp",
- "//third_party/icu/icu4c/source/common/ubrk.cpp",
- "//third_party/icu/icu4c/source/common/bytesinkutil.cpp",
- "//third_party/icu/icu4c/source/common/localebuilder.cpp",
- "//third_party/icu/icu4c/source/common/rbbi_cache.cpp",
- "//third_party/icu/icu4c/source/common/ucnvhz.cpp",
- "//third_party/icu/icu4c/source/common/uniset_closure.cpp",
- "//third_party/icu/icu4c/source/common/uloc.cpp",
- "//third_party/icu/icu4c/source/common/utypes.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_u16.cpp",
- "//third_party/icu/icu4c/source/common/uniset_props.cpp",
- "//third_party/icu/icu4c/source/common/locbased.cpp",
- "//third_party/icu/icu4c/source/common/unistr_cnv.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_ct.cpp",
- "//third_party/icu/icu4c/source/common/unormcmp.cpp",
- "//third_party/icu/icu4c/source/common/wintz.cpp",
- "//third_party/icu/icu4c/source/common/ruleiter.cpp",
- "//third_party/icu/icu4c/source/common/utrie2.cpp",
- "//third_party/icu/icu4c/source/common/locresdata.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_u8.cpp",
- "//third_party/icu/icu4c/source/common/uscript_props.cpp",
- "//third_party/icu/icu4c/source/common/locdspnm.cpp",
- "//third_party/icu/icu4c/source/common/locid.cpp",
- "//third_party/icu/icu4c/source/common/rbbitblb.cpp",
- "//third_party/icu/icu4c/source/common/icudataver.cpp",
- "//third_party/icu/icu4c/source/common/ubidi.cpp",
- "//third_party/icu/icu4c/source/common/brkiter.cpp",
- "//third_party/icu/icu4c/source/common/uvectr32.cpp",
- "//third_party/icu/icu4c/source/common/usc_impl.cpp",
- "//third_party/icu/icu4c/source/common/normlzr.cpp",
- "//third_party/icu/icu4c/source/common/icuplug.cpp",
- "//third_party/icu/icu4c/source/common/uvector.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_set.cpp",
- "//third_party/icu/icu4c/source/common/udataswp.cpp",
- "//third_party/icu/icu4c/source/common/uhash_us.cpp",
- "//third_party/icu/icu4c/source/common/rbbisetb.cpp",
- "//third_party/icu/icu4c/source/common/ubidi_props.cpp",
- "//third_party/icu/icu4c/source/common/ucmndata.cpp",
- "//third_party/icu/icu4c/source/common/locdistance.cpp",
- "//third_party/icu/icu4c/source/common/serv.cpp",
- "//third_party/icu/icu4c/source/common/utrie_swap.cpp",
- "//third_party/icu/icu4c/source/common/uchar.cpp",
- "//third_party/icu/icu4c/source/common/uloc_tag.cpp",
- "//third_party/icu/icu4c/source/common/ustr_titlecase_brkiter.cpp",
- "//third_party/icu/icu4c/source/common/pluralmap.cpp",
- "//third_party/icu/icu4c/source/common/lsr.cpp",
- "//third_party/icu/icu4c/source/common/uhash.cpp",
- "//third_party/icu/icu4c/source/common/propname.cpp",
- "//third_party/icu/icu4c/source/common/ucnvlat1.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_ext.cpp",
- "//third_party/icu/icu4c/source/common/ubidiln.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_cb.cpp",
- "//third_party/icu/icu4c/source/common/static_unicode_sets.cpp",
- "//third_party/icu/icu4c/source/common/dictbe.cpp",
- "//third_party/icu/icu4c/source/common/stringtriebuilder.cpp",
- "//third_party/icu/icu4c/source/common/uvectr64.cpp",
- "//third_party/icu/icu4c/source/common/patternprops.cpp",
- "//third_party/icu/icu4c/source/common/propsvec.cpp",
- "//third_party/icu/icu4c/source/common/ustrenum.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_u32.cpp",
- "//third_party/icu/icu4c/source/common/ustr_cnv.cpp",
- "//third_party/icu/icu4c/source/common/edits.cpp",
- "//third_party/icu/icu4c/source/common/loclikely.cpp",
- "//third_party/icu/icu4c/source/common/parsepos.cpp",
- "//third_party/icu/icu4c/source/common/loclikelysubtags.cpp",
- "//third_party/icu/icu4c/source/common/uloc_keytype.cpp",
- "//third_party/icu/icu4c/source/common/appendable.cpp",
- "//third_party/icu/icu4c/source/common/filteredbrk.cpp",
- "//third_party/icu/icu4c/source/common/ucharstrie.cpp",
- "//third_party/icu/icu4c/source/common/uiter.cpp",
- "//third_party/icu/icu4c/source/common/messagepattern.cpp",
- "//third_party/icu/icu4c/source/common/servrbf.cpp",
- "//third_party/icu/icu4c/source/common/rbbirb.cpp",
- "//third_party/icu/icu4c/source/common/uinit.cpp",
- "//third_party/icu/icu4c/source/common/stringpiece.cpp",
- "//third_party/icu/icu4c/source/common/normalizer2impl.cpp",
- "//third_party/icu/icu4c/source/common/ucharstriebuilder.cpp",
- "//third_party/icu/icu4c/source/common/uobject.cpp",
- "//third_party/icu/icu4c/source/common/ushape.cpp",
- "//third_party/icu/icu4c/source/common/ucasemap.cpp",
- "//third_party/icu/icu4c/source/common/uinvchar.cpp",
- "//third_party/icu/icu4c/source/common/utf_impl.cpp",
- "//third_party/icu/icu4c/source/common/ustack.cpp",
- "//third_party/icu/icu4c/source/common/characterproperties.cpp",
- "//third_party/icu/icu4c/source/common/rbbi.cpp",
- "//third_party/icu/icu4c/source/common/ucasemap_titlecase_brkiter.cpp",
- "//third_party/icu/icu4c/source/common/caniter.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_bld.cpp",
- "//third_party/icu/icu4c/source/common/ucln_cmn.cpp",
- "//third_party/icu/icu4c/source/common/chariter.cpp",
- "//third_party/icu/icu4c/source/common/punycode.cpp",
- "//third_party/icu/icu4c/source/common/ustrtrns.cpp",
- "//third_party/icu/icu4c/source/common/ucnvmbcs.cpp",
- "//third_party/icu/icu4c/source/common/bytestream.cpp",
- "//third_party/icu/icu4c/source/common/servlkf.cpp",
- "//third_party/icu/icu4c/source/common/udatamem.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_io.cpp",
- "//third_party/icu/icu4c/source/common/dtintrv.cpp",
- "//third_party/icu/icu4c/source/common/cstr.cpp",
- "//third_party/icu/icu4c/source/common/ulist.cpp",
- "//third_party/icu/icu4c/source/common/ucnvisci.cpp",
- "//third_party/icu/icu4c/source/common/brkeng.cpp",
- "//third_party/icu/icu4c/source/common/localematcher.cpp",
- "//third_party/icu/icu4c/source/common/umutablecptrie.cpp",
- "//third_party/icu/icu4c/source/common/locdispnames.cpp",
- "//third_party/icu/icu4c/source/common/uchriter.cpp",
- "//third_party/icu/icu4c/source/common/uresdata.cpp",
- "//third_party/icu/icu4c/source/common/unifiedcache.cpp",
- "//third_party/icu/icu4c/source/common/dictionarydata.cpp",
- "//third_party/icu/icu4c/source/common/uscript.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_u7.cpp",
- "//third_party/icu/icu4c/source/common/unistr_case.cpp",
- "//third_party/icu/icu4c/source/common/ucat.cpp",
- "//third_party/icu/icu4c/source/common/resource.cpp",
- "//third_party/icu/icu4c/source/common/usprep.cpp",
- "//third_party/icu/icu4c/source/common/ucnvdisp.cpp",
- "//third_party/icu/icu4c/source/common/uniset.cpp",
- "//third_party/icu/icu4c/source/common/ucnv.cpp",
- "//third_party/icu/icu4c/source/common/ucnvscsu.cpp",
- "//third_party/icu/icu4c/source/common/uset_props.cpp",
- "//third_party/icu/icu4c/source/common/umutex.cpp",
- "//third_party/icu/icu4c/source/common/ucnv_cnv.cpp",
- "//third_party/icu/icu4c/source/common/locmap.cpp",
- "//third_party/icu/icu4c/source/common/resbund.cpp",
- "//third_party/icu/icu4c/source/common/filterednormalizer2.cpp",
- "//third_party/icu/icu4c/source/common/uprops.cpp",
- "//third_party/icu/icu4c/source/common/schriter.cpp",
- "//third_party/icu/icu4c/source/common/simpleformatter.cpp",
- "//third_party/icu/icu4c/source/common/uts46.cpp",
- "//third_party/icu/icu4c/source/common/ucol_swp.cpp",
- "//third_party/icu/icu4c/source/common/udata.cpp",
- "//third_party/icu/icu4c/source/common/ustrfmt.cpp",
- "//third_party/icu/icu4c/source/common/servslkf.cpp",
- "//third_party/icu/icu4c/source/common/servls.cpp",
- "//third_party/icu/icu4c/source/common/unistr_props.cpp",
- "//third_party/icu/icu4c/source/common/utrace.cpp",
- "//third_party/icu/icu4c/source/common/utrie2_builder.cpp",
- "//third_party/icu/icu4c/source/common/ucase.cpp",
- "//third_party/icu/icu4c/source/common/cmemory.cpp",
- "//third_party/icu/icu4c/source/common/uset.cpp",
- "//third_party/icu/icu4c/source/common/unistr_case_locale.cpp",
- "//third_party/icu/icu4c/source/common/ures_cnv.cpp",
- "//third_party/icu/icu4c/source/common/charstr.cpp",
- "//third_party/icu/icu4c/source/common/uidna.cpp",
- "//third_party/icu/icu4c/source/common/normalizer2.cpp",
- "//third_party/icu/icu4c/source/common/resbund_cnv.cpp",
- "//third_party/icu/icu4c/source/common/umath.cpp",
- "//third_party/icu/icu4c/source/common/utext.cpp",
- "//third_party/icu/icu4c/source/common/ucurr.cpp",
- "//third_party/icu/icu4c/source/common/util_props.cpp",
- "//third_party/icu/icu4c/source/common/unorm.cpp",
- "//third_party/icu/icu4c/source/common/ubidiwrt.cpp",
- "//third_party/icu/icu4c/source/common/usetiter.cpp",
- "//third_party/icu/icu4c/source/common/rbbinode.cpp",
- "//third_party/icu/icu4c/source/common/ustrcase.cpp",
- "//third_party/icu/icu4c/source/common/servnotf.cpp",
- "//third_party/icu/icu4c/source/ohos/init_data.cpp",
-]
-
-icu_i18n_source = [
- "//third_party/icu/icu4c/source/i18n/number_capi.cpp",
- "//third_party/icu/icu4c/source/i18n/upluralrules.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_currency.cpp",
- "//third_party/icu/icu4c/source/i18n/ufieldpositer.cpp",
- "//third_party/icu/icu4c/source/i18n/number_output.cpp",
- "//third_party/icu/icu4c/source/i18n/number_currencysymbols.cpp",
- "//third_party/icu/icu4c/source/i18n/curramt.cpp",
- "//third_party/icu/icu4c/source/i18n/alphaindex.cpp",
- "//third_party/icu/icu4c/source/i18n/indiancal.cpp",
- "//third_party/icu/icu4c/source/i18n/dayperiodrules.cpp",
- "//third_party/icu/icu4c/source/i18n/quantityformatter.cpp",
- "//third_party/icu/icu4c/source/i18n/collationfastlatinbuilder.cpp",
- "//third_party/icu/icu4c/source/i18n/csrucode.cpp",
- "//third_party/icu/icu4c/source/i18n/measunit_extra.cpp",
- "//third_party/icu/icu4c/source/i18n/ethpccal.cpp",
- "//third_party/icu/icu4c/source/i18n/anytrans.cpp",
- "//third_party/icu/icu4c/source/i18n/number_scientific.cpp",
- "//third_party/icu/icu4c/source/i18n/cpdtrans.cpp",
- "//third_party/icu/icu4c/source/i18n/regexst.cpp",
- "//third_party/icu/icu4c/source/i18n/numfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/formattedvalue.cpp",
- "//third_party/icu/icu4c/source/i18n/unesctrn.cpp",
- "//third_party/icu/icu4c/source/i18n/ucoleitr.cpp",
- "//third_party/icu/icu4c/source/i18n/tmutamt.cpp",
- "//third_party/icu/icu4c/source/i18n/transreg.cpp",
- "//third_party/icu/icu4c/source/i18n/unum.cpp",
- "//third_party/icu/icu4c/source/i18n/number_longnames.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_affixes.cpp",
- "//third_party/icu/icu4c/source/i18n/plurrule.cpp",
- "//third_party/icu/icu4c/source/i18n/zrule.cpp",
- "//third_party/icu/icu4c/source/i18n/collationrootelements.cpp",
- "//third_party/icu/icu4c/source/i18n/currunit.cpp",
- "//third_party/icu/icu4c/source/i18n/funcrepl.cpp",
- "//third_party/icu/icu4c/source/i18n/collationdatareader.cpp",
- "//third_party/icu/icu4c/source/i18n/buddhcal.cpp",
- "//third_party/icu/icu4c/source/i18n/number_decimalquantity.cpp",
- "//third_party/icu/icu4c/source/i18n/scriptset.cpp",
- "//third_party/icu/icu4c/source/i18n/fmtable.cpp",
- "//third_party/icu/icu4c/source/i18n/regextxt.cpp",
- "//third_party/icu/icu4c/source/i18n/bocsu.cpp",
- "//third_party/icu/icu4c/source/i18n/olsontz.cpp",
- "//third_party/icu/icu4c/source/i18n/utmscale.cpp",
- "//third_party/icu/icu4c/source/i18n/ucol.cpp",
- "//third_party/icu/icu4c/source/i18n/currfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/hebrwcal.cpp",
- "//third_party/icu/icu4c/source/i18n/ucol_sit.cpp",
- "//third_party/icu/icu4c/source/i18n/rbnf.cpp",
- "//third_party/icu/icu4c/source/i18n/decContext.cpp",
- "//third_party/icu/icu4c/source/i18n/collationdatawriter.cpp",
- "//third_party/icu/icu4c/source/i18n/csr2022.cpp",
- "//third_party/icu/icu4c/source/i18n/dtrule.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_validators.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_parsednumber.cpp",
- "//third_party/icu/icu4c/source/i18n/double-conversion-fast-dtoa.cpp",
- "//third_party/icu/icu4c/source/i18n/choicfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/format.cpp",
- "//third_party/icu/icu4c/source/i18n/reldatefmt.cpp",
- "//third_party/icu/icu4c/source/i18n/double-conversion-double-to-string.cpp",
- "//third_party/icu/icu4c/source/i18n/rbt_data.cpp",
- "//third_party/icu/icu4c/source/i18n/smpdtfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/double-conversion-bignum-dtoa.cpp",
- "//third_party/icu/icu4c/source/i18n/number_padding.cpp",
- "//third_party/icu/icu4c/source/i18n/vtzone.cpp",
- "//third_party/icu/icu4c/source/i18n/region.cpp",
- "//third_party/icu/icu4c/source/i18n/coptccal.cpp",
- "//third_party/icu/icu4c/source/i18n/datefmt.cpp",
- "//third_party/icu/icu4c/source/i18n/formatted_string_builder.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_impl.cpp",
- "//third_party/icu/icu4c/source/i18n/plurfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/rematch.cpp",
- "//third_party/icu/icu4c/source/i18n/simpletz.cpp",
- "//third_party/icu/icu4c/source/i18n/search.cpp",
- "//third_party/icu/icu4c/source/i18n/number_mapper.cpp",
- "//third_party/icu/icu4c/source/i18n/inputext.cpp",
- "//third_party/icu/icu4c/source/i18n/dtptngen.cpp",
- "//third_party/icu/icu4c/source/i18n/coleitr.cpp",
- "//third_party/icu/icu4c/source/i18n/collationweights.cpp",
- "//third_party/icu/icu4c/source/i18n/number_modifiers.cpp",
- "//third_party/icu/icu4c/source/i18n/scientificnumberformatter.cpp",
- "//third_party/icu/icu4c/source/i18n/vzone.cpp",
- "//third_party/icu/icu4c/source/i18n/fphdlimp.cpp",
- "//third_party/icu/icu4c/source/i18n/udatpg.cpp",
- "//third_party/icu/icu4c/source/i18n/collationfcd.cpp",
- "//third_party/icu/icu4c/source/i18n/tridpars.cpp",
- "//third_party/icu/icu4c/source/i18n/csmatch.cpp",
- "//third_party/icu/icu4c/source/i18n/dangical.cpp",
- "//third_party/icu/icu4c/source/i18n/ulocdata.cpp",
- "//third_party/icu/icu4c/source/i18n/double-conversion-strtod.cpp",
- "//third_party/icu/icu4c/source/i18n/erarules.cpp",
- "//third_party/icu/icu4c/source/i18n/numsys.cpp",
- "//third_party/icu/icu4c/source/i18n/csdetect.cpp",
- "//third_party/icu/icu4c/source/i18n/japancal.cpp",
- "//third_party/icu/icu4c/source/i18n/collation.cpp",
- "//third_party/icu/icu4c/source/i18n/uregex.cpp",
- "//third_party/icu/icu4c/source/i18n/timezone.cpp",
- "//third_party/icu/icu4c/source/i18n/strmatch.cpp",
- "//third_party/icu/icu4c/source/i18n/decNumber.cpp",
- "//third_party/icu/icu4c/source/i18n/nortrans.cpp",
- "//third_party/icu/icu4c/source/i18n/sortkey.cpp",
- "//third_party/icu/icu4c/source/i18n/ulistformatter.cpp",
- "//third_party/icu/icu4c/source/i18n/tzgnames.cpp",
- "//third_party/icu/icu4c/source/i18n/number_multiplier.cpp",
- "//third_party/icu/icu4c/source/i18n/ztrans.cpp",
- "//third_party/icu/icu4c/source/i18n/persncal.cpp",
- "//third_party/icu/icu4c/source/i18n/number_utils.cpp",
- "//third_party/icu/icu4c/source/i18n/csrmbcs.cpp",
- "//third_party/icu/icu4c/source/i18n/taiwncal.cpp",
- "//third_party/icu/icu4c/source/i18n/dtitvinf.cpp",
- "//third_party/icu/icu4c/source/i18n/astro.cpp",
- "//third_party/icu/icu4c/source/i18n/number_patternmodifier.cpp",
- "//third_party/icu/icu4c/source/i18n/rulebasedcollator.cpp",
- "//third_party/icu/icu4c/source/i18n/msgfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/stsearch.cpp",
- "//third_party/icu/icu4c/source/i18n/number_affixutils.cpp",
- "//third_party/icu/icu4c/source/i18n/quant.cpp",
- "//third_party/icu/icu4c/source/i18n/calendar.cpp",
- "//third_party/icu/icu4c/source/i18n/collationroot.cpp",
- "//third_party/icu/icu4c/source/i18n/rbt_rule.cpp",
- "//third_party/icu/icu4c/source/i18n/number_compact.cpp",
- "//third_party/icu/icu4c/source/i18n/name2uni.cpp",
- "//third_party/icu/icu4c/source/i18n/chnsecal.cpp",
- "//third_party/icu/icu4c/source/i18n/csrutf8.cpp",
- "//third_party/icu/icu4c/source/i18n/basictz.cpp",
- "//third_party/icu/icu4c/source/i18n/reldtfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/nultrans.cpp",
- "//third_party/icu/icu4c/source/i18n/number_grouping.cpp",
- "//third_party/icu/icu4c/source/i18n/rbt_pars.cpp",
- "//third_party/icu/icu4c/source/i18n/nounit.cpp",
- "//third_party/icu/icu4c/source/i18n/winnmfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/uregexc.cpp",
- "//third_party/icu/icu4c/source/i18n/fpositer.cpp",
- "//third_party/icu/icu4c/source/i18n/tmutfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/compactdecimalformat.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_decimal.cpp",
- "//third_party/icu/icu4c/source/i18n/number_notation.cpp",
- "//third_party/icu/icu4c/source/i18n/uspoof_conf.cpp",
- "//third_party/icu/icu4c/source/i18n/utf16collationiterator.cpp",
- "//third_party/icu/icu4c/source/i18n/udat.cpp",
- "//third_party/icu/icu4c/source/i18n/number_skeletons.cpp",
- "//third_party/icu/icu4c/source/i18n/utrans.cpp",
- "//third_party/icu/icu4c/source/i18n/number_rounding.cpp",
- "//third_party/icu/icu4c/source/i18n/double-conversion-bignum.cpp",
- "//third_party/icu/icu4c/source/i18n/number_asformat.cpp",
- "//third_party/icu/icu4c/source/i18n/double-conversion-string-to-double.cpp",
- "//third_party/icu/icu4c/source/i18n/rbtz.cpp",
- "//third_party/icu/icu4c/source/i18n/csrsbcs.cpp",
- "//third_party/icu/icu4c/source/i18n/selfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/tztrans.cpp",
- "//third_party/icu/icu4c/source/i18n/uspoof_impl.cpp",
- "//third_party/icu/icu4c/source/i18n/regeximp.cpp",
- "//third_party/icu/icu4c/source/i18n/measure.cpp",
- "//third_party/icu/icu4c/source/i18n/fmtable_cnv.cpp",
- "//third_party/icu/icu4c/source/i18n/uspoof.cpp",
- "//third_party/icu/icu4c/source/i18n/gregoimp.cpp",
- "//third_party/icu/icu4c/source/i18n/umsg.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_symbols.cpp",
- "//third_party/icu/icu4c/source/i18n/numrange_impl.cpp",
- "//third_party/icu/icu4c/source/i18n/collationtailoring.cpp",
- "//third_party/icu/icu4c/source/i18n/double-conversion-cached-powers.cpp",
- "//third_party/icu/icu4c/source/i18n/udateintervalformat.cpp",
- "//third_party/icu/icu4c/source/i18n/uni2name.cpp",
- "//third_party/icu/icu4c/source/i18n/casetrn.cpp",
- "//third_party/icu/icu4c/source/i18n/windtfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/listformatter.cpp",
- "//third_party/icu/icu4c/source/i18n/uregion.cpp",
- "//third_party/icu/icu4c/source/i18n/usearch.cpp",
- "//third_party/icu/icu4c/source/i18n/brktrans.cpp",
- "//third_party/icu/icu4c/source/i18n/gender.cpp",
- "//third_party/icu/icu4c/source/i18n/collationruleparser.cpp",
- "//third_party/icu/icu4c/source/i18n/rbt.cpp",
- "//third_party/icu/icu4c/source/i18n/tzfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/dtfmtsym.cpp",
- "//third_party/icu/icu4c/source/i18n/tolowtrn.cpp",
- "//third_party/icu/icu4c/source/i18n/collationdatabuilder.cpp",
- "//third_party/icu/icu4c/source/i18n/unumsys.cpp",
- "//third_party/icu/icu4c/source/i18n/csrecog.cpp",
- "//third_party/icu/icu4c/source/i18n/collationfastlatin.cpp",
- "//third_party/icu/icu4c/source/i18n/esctrn.cpp",
- "//third_party/icu/icu4c/source/i18n/collationdata.cpp",
- "//third_party/icu/icu4c/source/i18n/titletrn.cpp",
- "//third_party/icu/icu4c/source/i18n/ucal.cpp",
- "//third_party/icu/icu4c/source/i18n/regexcmp.cpp",
- "//third_party/icu/icu4c/source/i18n/wintzimpl.cpp",
- "//third_party/icu/icu4c/source/i18n/decimfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/tmunit.cpp",
- "//third_party/icu/icu4c/source/i18n/number_integerwidth.cpp",
- "//third_party/icu/icu4c/source/i18n/ucsdet.cpp",
- "//third_party/icu/icu4c/source/i18n/uspoof_build.cpp",
- "//third_party/icu/icu4c/source/i18n/ucln_in.cpp",
- "//third_party/icu/icu4c/source/i18n/measfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/formattedval_iterimpl.cpp",
- "//third_party/icu/icu4c/source/i18n/toupptrn.cpp",
- "//third_party/icu/icu4c/source/i18n/translit.cpp",
- "//third_party/icu/icu4c/source/i18n/dtitvfmt.cpp",
- "//third_party/icu/icu4c/source/i18n/dcfmtsym.cpp",
- "//third_party/icu/icu4c/source/i18n/islamcal.cpp",
- "//third_party/icu/icu4c/source/i18n/numrange_fluent.cpp",
- "//third_party/icu/icu4c/source/i18n/gregocal.cpp",
- "//third_party/icu/icu4c/source/i18n/zonemeta.cpp",
- "//third_party/icu/icu4c/source/i18n/collationbuilder.cpp",
- "//third_party/icu/icu4c/source/i18n/string_segment.cpp",
- "//third_party/icu/icu4c/source/i18n/collationkeys.cpp",
- "//third_party/icu/icu4c/source/i18n/coll.cpp",
- "//third_party/icu/icu4c/source/i18n/uitercollationiterator.cpp",
- "//third_party/icu/icu4c/source/i18n/nfsubs.cpp",
- "//third_party/icu/icu4c/source/i18n/smpdtfst.cpp",
- "//third_party/icu/icu4c/source/i18n/collationsettings.cpp",
- "//third_party/icu/icu4c/source/i18n/formattedval_sbimpl.cpp",
- "//third_party/icu/icu4c/source/i18n/strrepl.cpp",
- "//third_party/icu/icu4c/source/i18n/standardplural.cpp",
- "//third_party/icu/icu4c/source/i18n/ucol_res.cpp",
- "//third_party/icu/icu4c/source/i18n/repattrn.cpp",
- "//third_party/icu/icu4c/source/i18n/tznames_impl.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_compositions.cpp",
- "//third_party/icu/icu4c/source/i18n/rbt_set.cpp",
- "//third_party/icu/icu4c/source/i18n/currpinf.cpp",
- "//third_party/icu/icu4c/source/i18n/collationsets.cpp",
- "//third_party/icu/icu4c/source/i18n/cecal.cpp",
- "//third_party/icu/icu4c/source/i18n/tzrule.cpp",
- "//third_party/icu/icu4c/source/i18n/collationiterator.cpp",
- "//third_party/icu/icu4c/source/i18n/numparse_scientific.cpp",
- "//third_party/icu/icu4c/source/i18n/number_patternstring.cpp",
- "//third_party/icu/icu4c/source/i18n/utf8collationiterator.cpp",
- "//third_party/icu/icu4c/source/i18n/sharedbreakiterator.cpp",
- "//third_party/icu/icu4c/source/i18n/number_fluent.cpp",
- "//third_party/icu/icu4c/source/i18n/measunit.cpp",
- "//third_party/icu/icu4c/source/i18n/collationcompare.cpp",
- "//third_party/icu/icu4c/source/i18n/number_formatimpl.cpp",
- "//third_party/icu/icu4c/source/i18n/number_decimfmtprops.cpp",
- "//third_party/icu/icu4c/source/i18n/nfrs.cpp",
- "//third_party/icu/icu4c/source/i18n/tznames.cpp",
- "//third_party/icu/icu4c/source/i18n/remtrans.cpp",
- "//third_party/icu/icu4c/source/i18n/nfrule.cpp",
-]
-
-ark_shared_library("shared_icuuc") {
- configs = [
- ":icu_config",
- "$build_root/config/compiler:rtti",
- ]
- deps = [ ":static_icustubdata" ]
- defines = [
- "U_ATTRIBUTE_DEPRECATED=",
- "U_COMMON_IMPLEMENTATION",
- "UPRV_BLOCK_MACRO_BEGIN=",
- "UPRV_BLOCK_MACRO_END=",
- "UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
- "_REENTRANT",
- ]
- sources = icu_common_source
- cflags_cc = [
- "-O3",
- "-W",
- "-Wall",
- "-pedantic",
- "-Wpointer-arith",
- "-Wwrite-strings",
- "-Wno-error=unused-parameter",
- "-Wno-error=unused-const-variable",
- "-Wno-error=unneeded-internal-declaration",
- "-std=c++11",
- "-Wno-ignored-attributes",
- ]
- ldflags = [
- "-shared",
- "-lm",
- ]
- output_name = "hmicuuc"
-}
-
-ark_shared_library("shared_icui18n") {
- sources = icu_i18n_source
- configs = [
- ":icu_config",
- "$build_root/config/compiler:rtti",
- ]
- deps = [ ":shared_icuuc" ]
- defines = [
- "U_ATTRIBUTE_DEPRECATED=",
- "U_I18N_IMPLEMENTATION",
- "UPRV_BLOCK_MACRO_BEGIN=",
- "UPRV_BLOCK_MACRO_END=",
- "_REENTRANT",
- "PIC",
- ]
- cflags_cc = [
- "-O3",
- "-W",
- "-Wall",
- "-pedantic",
- "-Wpointer-arith",
- "-Wno-error=unused-parameter",
- "-Wno-error=unused-const-variable",
- "-Wno-error=implicit-float-conversion",
- "-Wno-error=unneeded-internal-declaration",
- "-Wwrite-strings",
- "-std=c++11",
- "-Wno-ignored-attributes",
- ]
- ldflags = [
- "-shared",
- "-lm",
- ]
- if (!is_mingw) {
- cflags_cc += [ "-fPIC" ]
- ldflags += [ "-ldl" ]
- }
- output_name = "hmicui18n"
-}
-
-ark_static_library("static_icuuc") {
- configs = [
- ":icu_config",
- "$build_root/config/compiler:rtti",
- ]
- deps = [ ":static_icustubdata" ]
- defines = [
- "U_ATTRIBUTE_DEPRECATED=",
- "U_COMMON_IMPLEMENTATION",
- "U_STATIC_IMPLEMENTATION",
- "UPRV_BLOCK_MACRO_BEGIN=",
- "UPRV_BLOCK_MACRO_END=",
- "UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
- "_REENTRANT",
- ]
- sources = icu_common_source
- cflags_cc = [
- "-Os",
- "-W",
- "-Wall",
- "-pedantic",
- "-Wpointer-arith",
- "-Wwrite-strings",
- "-std=c++11",
- "-Wno-error=unused-parameter",
- "-Wno-error=unused-const-variable",
- "-Wno-error=unneeded-internal-declaration",
- "-fvisibility-inlines-hidden",
- "-Wno-unused-function",
- "-Wno-ignored-attributes",
- ]
-
- cflags = [
- "-fvisibility=hidden",
- "-fdata-sections",
- "-ffunction-sections",
- "-Os",
- "-Wno-unused-function",
- ]
-
- ldflags = [
- "-static",
- "-ldl",
- "-lm",
- ]
-
- output_name = "hmicuuc"
-}
-
-ark_static_library("static_icui18n") {
- sources = icu_i18n_source
- configs = [
- ":icu_config",
- "$build_root/config/compiler:rtti",
- ]
- deps = [ ":static_icuuc" ]
- defines = [
- "U_ATTRIBUTE_DEPRECATED=",
- "U_I18N_IMPLEMENTATION",
- "U_STATIC_IMPLEMENTATION",
- "UPRV_BLOCK_MACRO_BEGIN=",
- "UPRV_BLOCK_MACRO_END=",
- "_REENTRANT",
- "PIC",
- ]
-
- cflags_cc = [
- "-Os",
- "-W",
- "-Wall",
- "-pedantic",
- "-Wpointer-arith",
- "-Wwrite-strings",
- "-Wno-error=unused-parameter",
- "-Wno-error=unused-const-variable",
- "-Wno-error=implicit-float-conversion",
- "-Wno-error=unneeded-internal-declaration",
- "-std=c++11",
- "-fvisibility-inlines-hidden",
- "-fno-exceptions",
- "-Wno-ignored-attributes",
- ]
-
- if (is_mingw) {
- cflags_cc += [ "-DWINVER=0x0601" ]
- } else {
- cflags_cc += [ "-fPIC" ]
- }
-
- cflags = [
- "-fvisibility=hidden",
- "-fdata-sections",
- "-ffunction-sections",
- "-Os",
- ]
-
- ldflags = [
- "-static",
- "-ldl",
- "-lm",
- ]
- output_name = "hmicui18n"
-}
diff --git a/build/third_party_gn/zlib/BUILD.gn b/build/third_party_gn/zlib/BUILD.gn
deleted file mode 100644
index b6fc3603b71d355b9a83ff1e5d14e9002012b3fe..0000000000000000000000000000000000000000
--- a/build/third_party_gn/zlib/BUILD.gn
+++ /dev/null
@@ -1,63 +0,0 @@
-# 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("$build_root/ark.gni")
-
-config("zlib_config") {
- cflags = [
- "-Wno-incompatible-pointer-types",
- "-Werror",
- "-Wimplicit-function-declaration",
- "-fPIC",
- ]
-}
-
-config("zlib_public_config") {
- include_dirs = [ "." ]
-}
-
-ark_static_library("libz") {
- sources = [
- "//third_party/zlib/adler32.c",
- "//third_party/zlib/compress.c",
- "//third_party/zlib/contrib/minizip/ioapi.c",
- "//third_party/zlib/contrib/minizip/unzip.c",
- "//third_party/zlib/contrib/minizip/zip.c",
- "//third_party/zlib/crc32.c",
- "//third_party/zlib/crc32.h",
- "//third_party/zlib/deflate.c",
- "//third_party/zlib/deflate.h",
- "//third_party/zlib/gzclose.c",
- "//third_party/zlib/gzguts.h",
- "//third_party/zlib/gzlib.c",
- "//third_party/zlib/gzread.c",
- "//third_party/zlib/gzwrite.c",
- "//third_party/zlib/infback.c",
- "//third_party/zlib/inffast.c",
- "//third_party/zlib/inffast.h",
- "//third_party/zlib/inffixed.h",
- "//third_party/zlib/inflate.c",
- "//third_party/zlib/inflate.h",
- "//third_party/zlib/inftrees.c",
- "//third_party/zlib/inftrees.h",
- "//third_party/zlib/trees.c",
- "//third_party/zlib/trees.h",
- "//third_party/zlib/uncompr.c",
- "//third_party/zlib/zconf.h",
- "//third_party/zlib/zlib.h",
- "//third_party/zlib/zutil.c",
- "//third_party/zlib/zutil.h",
- ]
- configs = [ ":zlib_config" ]
- public_configs = [ ":zlib_public_config" ]
-}
diff --git a/docs/development-example-zh.md b/docs/development-example-zh.md
index 8a53e172c0119db8129671e8e04fe260f57e5746..bdebde868d86ab6881f72ea5a0a309cbf1902655 100644
--- a/docs/development-example-zh.md
+++ b/docs/development-example-zh.md
@@ -31,13 +31,13 @@
编译arm32版本:
```
- ./build.sh --product-name rk3568 --build-target libarkruntime --build-target ark_js_runtime --build-target ld-musl-arm.so.1
+ ./build.sh --product-name rk3568 --build-target ark_js_runtime --build-target ld-musl-arm.so.1
```
2. 编译方舟前端,编译命令:
```
- ./build.sh --product-name rk3568 --build-target ark_ts2abc_build
+ ./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc_build
```
**说明**:上述编译命令为release版本,且执行路径为项目根目录。编译debug版本需增加编译选项:--gn-args is_debug=true。
@@ -55,20 +55,20 @@
1. 通过方舟前端生成hello-world.abc文件,编译命令:
```
- node --expose-gc /your code path/out/rk3568/clang_x64/ark/ark/build/src/index.js hello-world.js
+ node --expose-gc /your code path/out/hispark_taurus/clang_x64/ark/ark/build/src/index.js hello-world.js
```
2. 执行hello-world.abc文件:
1. 设置搜索路径:
```
- export LD_LIBRARY_PATH= /your code path/out/rk3568/clang_x64/ark/ark:/your code path/out/rk3568/clang_x64/ark/ark_js_runtime:/your code path/out/rk3568/clang_x64/global/i18n_standard:/your code path/prebuilts/clang/ohos/linux-x86_64/llvm/lib
+ export LD_LIBRARY_PATH= /your code path/out/hispark_taurus/clang_x64/ark/ark:/your code path/out/hispark_taurus/clang_x64/ark/ark_js_runtime:/your code path/out/hispark_taurus/clang_x64/global/i18n_standard:/your code path/prebuilts/clang/ohos/linux-x86_64/llvm/lib
```
2. 执行ark\_js\_vm:
```
- /your code path/out/rk3568/clang_x64/ark/ark_js_runtime/ark_js_vm hello-world.abc
+ /your code path/out/hispark_taurus/clang_x64/ark/ark_js_runtime/ark_js_vm hello-world.abc
```
执行结果如下:
@@ -92,7 +92,7 @@
执行如下命令,结果输出到output.pa文件中:
```
-./your code path/out/rk3568/clang_x64/ark/ark/ark_disasm hello-world.abc output.pa
+./your code path/out/hispark_taurus/clang_x64/ark/ark/ark_disasm hello-world.abc output.pa
```
hello-world.abc反汇编结果如下:
@@ -139,13 +139,13 @@ hello-world.abc反汇编结果如下:
1. 编译方舟运行时,编译命令:
```
-./build.sh --product-name rk3568 --build-target ark_js_host_linux_tools_packages
+./build.sh --product-name hispark_taurus_standard --build-target ark_js_host_linux_tools_packages
```
1. 编译方舟前端,编译命令:
```
-./build.sh --product-name rk3568 --build-target ark_ts2abc_build
+./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc_build
```
**说明**:编译命令执行路径为项目根目录。
@@ -260,16 +260,20 @@ python3 test262/run_test262.py [options]
python3 test262/run_test262.py --es51
```
-- 仅运行ES2015测试用:
+- 仅运行ES2015测试用例:
```
- python3 test262/run_test262.py --es2015 only
+ python3 test262/run_test262.py --es2015
```
+- 仅运行ES2021测试用例:
-- 运行ES2015和ES51所有测试用例:
+ ```
+ python3 test262/run_test262.py --es2021 only
+
+- 运行ES2015和ES51和ES2021所有测试用例:
```
- python3 test262/run_test262.py --es2015 all
+ python3 test262/run_test262.py --es2021 all
```
- 运行单一测试用例:
@@ -305,7 +309,7 @@ node
test262/harness/bin/run.js
--hostType=panda
--hostPath=python3
- --hostArgs='-B test262/run_sunspider.py --ark-tool=/your code path/out/rk3568/clang_x64/ark/ark_js_runtime/ark_js_vm --ark-frontend-tool=/your code path/out/rk3568/clang_x64/ark/ark/build/src/index.js --libs-dir=/your code path/out/rk3568/clang_x64/ark/ark:/your code path/out/rk3568/clang_x64/global/i18n:/your code path/prebuilts/clang/ohos/linux-x86_64/llvm/lib/ --ark-frontend=ts2panda'
+ --hostArgs='-B test262/run_sunspider.py --ark-tool=/your code path/out/hispark_taurus/clang_x64/ark/ark_js_runtime/ark_js_vm --ark-frontend-tool=/your code path/out/hispark_taurus/clang_x64/ark/ark/build/src/index.js --libs-dir=/your code path/out/hispark_taurus/clang_x64/ark/ark:/your code path/out/hispark_taurus/clang_x64/global/i18n:/your code path/prebuilts/clang/ohos/linux-x86_64/llvm/lib/ --ark-frontend=ts2panda'
--threads=15
--mode=only strict mode
--timeout=60000
diff --git a/docs/development-example.md b/docs/development-example.md
index 444e4a42e4f93eccb426fe6f31a3194095d62cdd..ef262d35b77d7d9ec84d6ec3313aaf977105c445 100644
--- a/docs/development-example.md
+++ b/docs/development-example.md
@@ -29,7 +29,7 @@ This section describes how to develop and test ARK runtime.
arm32:
```
- ./build.sh --product-name rk3568 --build-target libarkruntime --build-target ark_js_runtime --build-target ld-musl-arm.so.1
+ ./build.sh --product-name rk3568 --build-target ark_js_runtime --build-target ld-musl-arm.so.1
```
**NOTE**: Run the compilation commands in the project root directory.
@@ -48,20 +48,20 @@ Run the **hello-world.js** file.
1. Use the ARK frontend to create the **hello-world.abc** file.
```
- node --expose-gc /your code path/out/rk3568/clang_x64/ark/ark/build/src/index.js hello-world.js
+ node --expose-gc /your code path/out/hispark_taurus/clang_x64/ark/ark/build/src/index.js hello-world.js
```
2. Run the **hello-world.abc** file.
1. Set the search path.
```
- export LD_LIBRARY_PATH= out/rk3568/clang_x64/ark/ark:out/rk3568/clang_x64/ark/ark_js_runtime:out/rk3568/clang_x64/global/i18n_standard:prebuilts/clang/ohos/linux-x86_64/llvm/lib
+ export LD_LIBRARY_PATH= out/hispark_taurus/clang_x64/ark/ark:out/hispark_taurus/clang_x64/ark/ark_js_runtime:out/hispark_taurus/clang_x64/global/i18n_standard:prebuilts/clang/ohos/linux-x86_64/llvm/lib
```
2. Run **ark\_js\_vm**.
```
- /your code path/out/rk3568/clang_x64/ark/ark_js_runtime/ark_js_vm hello-world.abc
+ /your code path/out/hispark_taurus/clang_x64/ark/ark_js_runtime/ark_js_vm hello-world.abc
```
The execution result is as follows:
@@ -77,7 +77,7 @@ Run the **hello-world.js** file.
Run the following command to export the result to the **output** file:
```
-./your code path/out/rk3568/clang_x64/ark/ark/ark_disasm hello-world.abc output
+./your code path/out/hispark_taurus/clang_x64/ark/ark/ark_disasm hello-world.abc output
```
The output is as follows:
@@ -124,13 +124,13 @@ The output is as follows:
1. Run the following command to compile ARK runtime:
```
-./build.sh --product-name rk3568 --build-target ark_js_host_linux_tools_packages
+./build.sh --product-name hispark_taurus_standard --build-target ark_js_host_linux_tools_packages
```
2. Run the following command to compile the ARK frontend:
```
-./build.sh --product-name rk3568 --build-target ark_ts2abc_build
+./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc_build
```
**NOTE**: Run the compilation commands in the project root directory.
@@ -251,13 +251,18 @@ Run the script in _Project root directory_**/ark/ts2abc**.
- Run test case ES2015 only.
```
- python3 test262/run_test262.py --es2015 only
+ python3 test262/run_test262.py --es2015
```
-- Run all ES2015 and ES51 test cases.
+- Run test case ES2021 only.
```
- python3 test262/run_test262.py --es2015 all
+ python3 test262/run_test262.py --es2021 only
+
+- Run all ES2015 and ES51 and ES2021 test cases.
+
+ ```
+ python3 test262/run_test262.py --es2021 all
```
- Run a test case.
@@ -293,7 +298,7 @@ node
test262/harness/bin/run.js
--hostType=panda
--hostPath=python3
- --hostArgs='-B test262/run_sunspider.py --ark-tool=/your code path/out/rk3568/clang_x64/ark/ark_js_runtime/ark_js_vm --ark-frontend-tool=/your code path/out/rk3568/clang_x64/ark/ark/build/src/index.js --libs-dir=/your code path/out/rk3568/clang_x64/ark/ark:/your code path/out/rk3568/clang_x64/global/i18n:/your code path/prebuilts/clang/ohos/linux-x86_64/llvm/lib/ --ark-frontend=ts2panda'
+ --hostArgs='-B test262/run_sunspider.py --ark-tool=/your code path/out/hispark_taurus/clang_x64/ark/ark_js_runtime/ark_js_vm --ark-frontend-tool=/your code path/out/hispark_taurus/clang_x64/ark/ark/build/src/index.js --libs-dir=/your code path/out/hispark_taurus/clang_x64/ark/ark:/your code path/out/hispark_taurus/clang_x64/global/i18n:/your code path/prebuilts/clang/ohos/linux-x86_64/llvm/lib/ --ark-frontend=ts2panda'
--threads=15
--mode=only strict mode
--timeout=60000
diff --git a/docs/environment-setup-and-compilation-zh.md b/docs/environment-setup-and-compilation-zh.md
index 47e6c17660ce63afcad25930e8fa7935399509dd..fea4f238a4d03719af47b44d6ae1c7685ed3afdd 100644
--- a/docs/environment-setup-and-compilation-zh.md
+++ b/docs/environment-setup-and-compilation-zh.md
@@ -14,7 +14,7 @@ Ubuntu版本要求18.04或20.04,详细环境搭建参考:
1. 首次编译:
```
- ./build.sh --product-name rk3568
+ ./build.sh --product-name hispark_taurus_standard
```
2. 首次编译后增量编译方舟运行时:
@@ -31,13 +31,13 @@ Ubuntu版本要求18.04或20.04,详细环境搭建参考:
编译arm32版本:
```
- ./build.sh --product-name rk3568 --build-target libarkruntime --build-target ark_js_runtime --build-target ld-musl-arm.so.1
+ ./build.sh --product-name rk3568 --build-target ark_js_runtime --build-target ld-musl-arm.so.1
```
3. 首次编译后增量编译方舟前端:
```
- ./build.sh --product-name rk3568 --build-target ark_ts2abc_build
+ ./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc_build
```
**说明**:上述编译命令为release版本,且执行路径为项目根目录。编译debug版本需增加编译选项:--gn-args is_debug=true。
@@ -45,9 +45,9 @@ Ubuntu版本要求18.04或20.04,详细环境搭建参考:
方舟相关的二进制文件在如下路径:
```
-out/rk3568/ark/ark/
-out/rk3568/ark/ark_js_runtime/
-out/rk3568/clang_x64/ark/ark/
-out/rk3568/clang_x64/ark/ark_js_runtime
+out/hispark_taurus/ark/ark/
+out/hispark_taurus/ark/ark_js_runtime/
+out/hispark_taurus/clang_x64/ark/ark/
+out/hispark_taurus/clang_x64/ark/ark_js_runtime
```
diff --git a/docs/environment-setup-and-compilation.md b/docs/environment-setup-and-compilation.md
index d8d0bfed8d8c8c5a31b93f295dab68c69485d291..5c73a9fe42c644e99cddc6053aecdef007e582cd 100644
--- a/docs/environment-setup-and-compilation.md
+++ b/docs/environment-setup-and-compilation.md
@@ -11,7 +11,7 @@ Use Ubuntu 18.04 or 20.04. For details about how to set up the environment, see:
1. First compilation:
```
- ./build.sh --product-name rk3568
+ ./build.sh --product-name hispark_taurus_standard
```
2. Compile an ARK runtime after the first compilation:
@@ -28,13 +28,13 @@ Use Ubuntu 18.04 or 20.04. For details about how to set up the environment, see:
arm32:
```
- ./build.sh --product-name rk3568 --build-target libarkruntime --build-target ark_js_runtime --build-target ld-musl-arm.so.1
+ ./build.sh --product-name rk3568 --build-target ark_js_runtime --build-target ld-musl-arm.so.1
```
3. Compile the ARK frontend after the first compilation:
```
- ./build.sh --product-name rk3568 --build-target ark_ts2abc_build
+ ./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc_build
```
**NOTE**: Run the compilation commands in the project root directory.
@@ -42,8 +42,8 @@ Use Ubuntu 18.04 or 20.04. For details about how to set up the environment, see:
The binary files related to ARK are available in the following paths:
```
-out/rk3568/ark/ark/
-out/rk3568/ark/ark_js_runtime/
-out/rk3568/clang_x64/ark/ark/
-out/rk3568/clang_x64/ark/ark_js_runtime
+out/hispark_taurus/ark/ark/
+out/hispark_taurus/ark/ark_js_runtime/
+out/hispark_taurus/clang_x64/ark/ark/
+out/hispark_taurus/clang_x64/ark/ark_js_runtime
```
diff --git a/docs/using-the-toolchain-zh.md b/docs/using-the-toolchain-zh.md
index 50d489197f0ec48ca4448e1fab9e3294af48ed33..8ea6b4ecf92d2d18146f66ba420fd4b6e5f891c4 100644
--- a/docs/using-the-toolchain-zh.md
+++ b/docs/using-the-toolchain-zh.md
@@ -9,13 +9,13 @@
构建编译:
```
-$ ./build.sh --product-name rk3568 --build-target ark_ts2abc_build
+$ ./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc_build
```
安装`node`和`npm`后, 使用前端工具:
```
-$ cd out/rk3568/clang_x64/ark/ark/build
+$ cd out/hispark_taurus/clang_x64/ark/ark/build
$ npm install
$ node --expose-gc src/index.js [选项] file.js
```
diff --git a/docs/using-the-toolchain.md b/docs/using-the-toolchain.md
index 637170afde25f93959cd7183c9fbdea386a5b486..fe1b811a5f1c0f2e4c3d2e3a18658a59a2443bda 100644
--- a/docs/using-the-toolchain.md
+++ b/docs/using-the-toolchain.md
@@ -9,13 +9,13 @@ Front-end tools, converting JS source code into ARK bytecode, can be built by sp
Build tools:
```
-$ ./build.sh --product-name rk3568 --build-target ark_ts2abc
+$ ./build.sh --product-name hispark_taurus_standard --build-target ark_ts2abc
```
Install `node` and `npm`, then use tools:
```
-$ cd out/rk3568/clang_x64/ark/ark/build
+$ cd out/hispark_taurus/clang_x64/ark/ark/build
$ npm install
$ node --expose-gc src/index.js [option] file.js
```
diff --git a/ecmascript/accessor_data.h b/ecmascript/accessor_data.h
index 4e132fecc420f480be218b0e1a10a44d93e6ed45..4d9e876e5bf0f6ed2d89a3eede68d7ef8904a934 100644
--- a/ecmascript/accessor_data.h
+++ b/ecmascript/accessor_data.h
@@ -30,7 +30,7 @@ public:
using InternalGetFunc = JSTaggedValue (*)(JSThread *, const JSHandle &);
using InternalSetFunc = bool (*)(JSThread *, const JSHandle &, const JSHandle &, bool);
- static AccessorData *Cast(ObjectHeader *object)
+ static AccessorData *Cast(TaggedObject *object)
{
ASSERT(JSTaggedValue(object).IsAccessorData() || JSTaggedValue(object).IsInternalAccessor());
return static_cast(object);
@@ -81,7 +81,7 @@ enum class CompletionRecordType : uint8_t {
class CompletionRecord final : public Record {
public:
- static CompletionRecord *Cast(ObjectHeader *object)
+ static CompletionRecord *Cast(TaggedObject *object)
{
ASSERT(JSTaggedValue(object).IsCompletionRecord());
return static_cast(object);
diff --git a/ecmascript/base/array_helper.cpp b/ecmascript/base/array_helper.cpp
index b8e383859e0b3b1bbdd587c86b0674e63429be68..2735b363a7519e7669db59a900ce1ec5a03e5141 100644
--- a/ecmascript/base/array_helper.cpp
+++ b/ecmascript/base/array_helper.cpp
@@ -81,10 +81,11 @@ int32_t ArrayHelper::SortCompare(JSThread *thread, const JSHandle
// d. Return v.
if (!callbackfnHandle->IsUndefined()) {
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackfnHandle, undefined, undefined, 2); // 2: «x, y»
- info.SetCallArg(valueX.GetTaggedValue(), valueY.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, 0);
+ info->SetCallArg(valueX.GetTaggedValue(), valueY.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
if (callResult.IsInt()) {
return callResult.GetInt();
}
@@ -193,12 +194,13 @@ JSTaggedValue ArrayHelper::FlattenIntoArray(JSThread *thread, const JSHandleIsUndefined()) {
- const size_t argsLength = 3; // 3: « element, sourceIndex, source »
+ const int32_t argsLength = 3; // 3: « element, sourceIndex, source »
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, mapperFunctionHandle, thisArg, undefined, argsLength);
- info.SetCallArg(element.GetTaggedValue(), p.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue obj = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(element.GetTaggedValue(), p.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue obj = JSFunction::Call(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
element.Update(obj);
}
diff --git a/ecmascript/base/atomic_helper.cpp b/ecmascript/base/atomic_helper.cpp
index 950881094325693934435aaa1ce89790e7d22824..1ec2138072e776fdb750cc4e5d181281c5f6abdb 100644
--- a/ecmascript/base/atomic_helper.cpp
+++ b/ecmascript/base/atomic_helper.cpp
@@ -85,7 +85,7 @@ uint32_t AtomicHelper::ValidateAtomicAccess(JSThread *thread, const JSHandleGetByteOffset();
// 9. Return (accessIndex × elementSize) + offset.
- uint32_t allOffset = index * elementSize + offset;
+ uint32_t allOffset = static_cast(index) * elementSize + offset;
return allOffset;
}
diff --git a/ecmascript/base/builtins_base.h b/ecmascript/base/builtins_base.h
index be50bb83cc00234aa705531d52f3a8d29a487dd1..1a7bbf6a7844c4bf048edbb23531ac2cb1106191 100644
--- a/ecmascript/base/builtins_base.h
+++ b/ecmascript/base/builtins_base.h
@@ -49,7 +49,7 @@ public:
return msg->GetNewTarget();
}
- static inline JSHandle GetCallArg(EcmaRuntimeCallInfo *msg, uint32_t position)
+ static inline JSHandle GetCallArg(EcmaRuntimeCallInfo *msg, int32_t position)
{
if (position >= msg->GetArgsNumber()) {
JSThread *thread = msg->GetThread();
diff --git a/ecmascript/base/config.h b/ecmascript/base/config.h
index 69ff97af1707a5b356129f81dd691f5420cff5fa..d67a96414b4ec0e4effee7ba660b960322bc5d0e 100644
--- a/ecmascript/base/config.h
+++ b/ecmascript/base/config.h
@@ -23,11 +23,14 @@ namespace panda::ecmascript {
#define ECMASCRIPT_ENABLE_DEBUG_MODE 0
#define ECMASCRIPT_ENABLE_ARK_CONTAINER 1
#define ECMASCRIPT_ENABLE_ASM_INTERPRETER_LOG 0
+#define ECMASCRIPT_ENABLE_VERBOSE_LEVEL_LOG 0
+#define ECMASCRIPT_ENABLE_INTERPRETER_LOG 0
#define ECMASCRIPT_ENABLE_RUNTIME_STAT 0 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define ECMASCRIPT_ENABLE_INTERPRETER_RUNTIME_STAT 0
#define ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT 0
#define ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT 0
+#define ECMASCRIPT_ENABLE_SNAPSHOT 0
/*
* 1. close ic
@@ -47,6 +50,7 @@ namespace panda::ecmascript {
#define ECMASCRIPT_SWITCH_GC_MODE_TO_FULL_GC 1
#define ECMASCRIPT_ENABLE_CAST_CHECK 1
#define ECMASCRIPT_ENABLE_NEW_HANDLE_CHECK 1
+ #define ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK 1
#define ECMASCRIPT_ENABLE_HEAP_VERIFY 1
#define ECMASCRIPT_ENABLE_THREAD_CHECK 1
#define ECMASCRIPT_ENABLE_ACTIVE_CPUPROFILER 0
@@ -58,6 +62,7 @@ namespace panda::ecmascript {
#define ECMASCRIPT_SWITCH_GC_MODE_TO_FULL_GC 0
#define ECMASCRIPT_ENABLE_CAST_CHECK 0
#define ECMASCRIPT_ENABLE_NEW_HANDLE_CHECK 0
+ #define ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK 0
#define ECMASCRIPT_ENABLE_HEAP_VERIFY 0
#define ECMASCRIPT_ENABLE_THREAD_CHECK 1
#define ECMASCRIPT_ENABLE_ACTIVE_CPUPROFILER 0
diff --git a/ecmascript/base/error_helper.cpp b/ecmascript/base/error_helper.cpp
index 6e0faefa489f900282e4d3738eee7f60f991982d..307f5f4c1568ac4799cec044c7fd4f990ec1041d 100644
--- a/ecmascript/base/error_helper.cpp
+++ b/ecmascript/base/error_helper.cpp
@@ -107,6 +107,9 @@ JSHandle ErrorHelper::GetErrorName(JSThread *thread, const JSHand
case ErrorType::TYPE_ERROR:
errorKey = reinterpret_cast(*globalConst->GetHandledTypeErrorString());
break;
+ case ErrorType::AGGREGATE_ERROR:
+ errorKey = reinterpret_cast(*globalConst->GetHandledAggregateErrorString());
+ break;
case ErrorType::URI_ERROR:
errorKey = reinterpret_cast(*globalConst->GetHandledURIErrorString());
break;
@@ -154,7 +157,7 @@ JSTaggedValue ErrorHelper::ErrorCommonConstructor(EcmaRuntimeCallInfo *argv,
auto globalConst = thread->GlobalConstants();
if (!message->IsUndefined()) {
JSHandle handleStr = JSTaggedValue::ToString(thread, message);
- LOG(DEBUG, ECMASCRIPT) << "Ark throw error: " << utf::Mutf8AsCString(handleStr->GetDataUtf8());
+ LOG_ECMA(DEBUG) << "Throw error: " << utf::Mutf8AsCString(handleStr->GetDataUtf8());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle msgKey = globalConst->GetHandledMessageString();
PropertyDescriptor msgDesc(thread, JSHandle::Cast(handleStr), true, false, true);
@@ -184,7 +187,7 @@ JSHandle ErrorHelper::BuildEcmaStackTrace(JSThread *thread)
{
std::string data = BuildJsStackTrace(thread, false);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
- LOG(DEBUG, ECMASCRIPT) << data;
+ LOG_ECMA(DEBUG) << data;
return factory->NewFromStdString(data);
}
@@ -220,12 +223,12 @@ std::string ErrorHelper::BuildJsStackTrace(JSThread *thread, bool needNative)
int lineNumber = 0;
auto callbackLineFunc = [&data, &lineNumber](int32_t line) -> bool {
lineNumber = line + 1;
- data += ToCString(lineNumber);
+ data += std::to_string(lineNumber);
data.push_back(':');
return true;
};
auto callbackColumnFunc = [&data](int32_t column) -> bool {
- data += ToCString(column + 1);
+ data += std::to_string(column + 1);
return true;
};
panda_file::File::EntityId methodId = method->GetMethodId();
diff --git a/ecmascript/base/error_type.h b/ecmascript/base/error_type.h
index 42a5dcd1528cf486a363d0a1c557d3ab05d46c65..868f1ad1c90b1c26728200a711726438cc6a74fd 100644
--- a/ecmascript/base/error_type.h
+++ b/ecmascript/base/error_type.h
@@ -27,6 +27,7 @@ enum class ErrorType : uint8_t {
SYNTAX_ERROR,
TYPE_ERROR,
URI_ERROR,
+ AGGREGATE_ERROR,
};
} // namespace panda::ecmascript::base
diff --git a/ecmascript/base/json_parser.cpp b/ecmascript/base/json_parser.cpp
index 95defa65a4ad20c814151daac9c7e0fe76325b28..3abb46ba6aa376e4b5caf1b98e69a8623a2a3e85 100644
--- a/ecmascript/base/json_parser.cpp
+++ b/ecmascript/base/json_parser.cpp
@@ -55,11 +55,12 @@ JSHandle Internalize::InternalizeJsonProperty(JSThread *thread, c
}
// Return ? Call(receiver, holder, « name, val »).
- const size_t argsLength = 2; // 2: « name, val »
+ const int32_t argsLength = 2; // 2: « name, val »
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info = EcmaInterpreter::NewRuntimeCallInfo(thread, receiver, objHandle, undefined, argsLength);
- info.SetCallArg(name.GetTaggedValue(), val.GetTaggedValue());
- JSTaggedValue result = JSFunction::Call(&info);
+ EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, receiver, objHandle, undefined, argsLength);
+ RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
+ info->SetCallArg(name.GetTaggedValue(), val.GetTaggedValue());
+ JSTaggedValue result = JSFunction::Call(info);
return JSHandle(thread, result);
}
diff --git a/ecmascript/base/json_stringifier.cpp b/ecmascript/base/json_stringifier.cpp
index 5e64e9bc65bfeb2d6a1f17a628b9d40b409965ee..02a2a6b1b8a1dedaed3127b03c877669bc550341 100644
--- a/ecmascript/base/json_stringifier.cpp
+++ b/ecmascript/base/json_stringifier.cpp
@@ -298,9 +298,10 @@ JSTaggedValue JsonStringifier::GetSerializeValue(const JSHandle &
// c. If IsCallable(toJSON) is true
if (UNLIKELY(toJsonFun->IsCallable())) {
// Let value be Call(toJSON, value, «key»).
- EcmaRuntimeCallInfo info = EcmaInterpreter::NewRuntimeCallInfo(thread_, toJsonFun, value, undefined, 1);
- info.SetCallArg(key.GetTaggedValue());
- tagValue = JSFunction::Call(&info);
+ EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread_, toJsonFun, value, undefined, 1);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_);
+ info->SetCallArg(key.GetTaggedValue());
+ tagValue = JSFunction::Call(info);
// ii. ReturnIfAbrupt(value).
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_);
}
@@ -309,11 +310,12 @@ JSTaggedValue JsonStringifier::GetSerializeValue(const JSHandle &
if (UNLIKELY(replacer->IsCallable())) {
handleValue_.Update(tagValue);
// a. Let value be Call(ReplacerFunction, holder, «key, value»).
- const size_t argsLength = 2; // 2: «key, value»
- EcmaRuntimeCallInfo info =
+ const int32_t argsLength = 2; // 2: «key, value»
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread_, replacer, object, undefined, argsLength);
- info.SetCallArg(key.GetTaggedValue(), handleValue_.GetTaggedValue());
- tagValue = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_);
+ info->SetCallArg(key.GetTaggedValue(), handleValue_.GetTaggedValue());
+ tagValue = JSFunction::Call(info);
// b. ReturnIfAbrupt(value).
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_);
}
@@ -374,6 +376,10 @@ JSTaggedValue JsonStringifier::SerializeJSONProperty(const JSHandle(valHandle)));
+ return tagValue;
+ }
default: {
if (!tagValue.IsCallable()) {
JSHClass *jsHclass = tagValue.GetTaggedObject()->GetClass();
diff --git a/ecmascript/base/number_helper.cpp b/ecmascript/base/number_helper.cpp
index caead58f0facbc084ae4c9ac91909ddbca90cdd9..bd23527d8d4262a5a23ddc5f63804f01b916207e 100644
--- a/ecmascript/base/number_helper.cpp
+++ b/ecmascript/base/number_helper.cpp
@@ -219,7 +219,7 @@ JSTaggedValue NumberHelper::StringToDoubleWithRadix(const uint8_t *start, const
for (; p != end; ++p) {
// The maximum value to ensure that uint32_t will not overflow
const uint32_t MAX_MULTIPER = 0xffffffffU / 36;
- uint32_t m = multiplier * radix;
+ uint32_t m = multiplier * static_cast(radix);
if (m > MAX_MULTIPER) {
break;
}
@@ -633,7 +633,7 @@ int32_t NumberHelper::DoubleToInt(double d, size_t bits)
// Still has significand bits after mod 2^
// Get low bits by shift left <64 - bits> and shift right <64 - bits>
uint64_t value = (((u64 & DOUBLE_SIGNIFICAND_MASK) | DOUBLE_HIDDEN_BIT)
- << (exp - DOUBLE_SIGNIFICAND_SIZE + INT64_BITS - bits)) >>
+ << (static_cast(exp) - DOUBLE_SIGNIFICAND_SIZE + INT64_BITS - bits)) >>
(INT64_BITS - bits);
ret = static_cast(value);
if ((u64 & DOUBLE_SIGN_MASK) == DOUBLE_SIGN_MASK && ret != INT32_MIN) {
@@ -749,14 +749,14 @@ void NumberHelper::GetBase(double d, int digits, int *decpt, char *buf, char *bu
{
int result = snprintf_s(bufTmp, size, size - 1, "%+.*e", digits - 1, d);
if (result == -1) {
- LOG_ECMA(FATAL) << "snprintf_s failed";
+ LOG_FULL(FATAL) << "snprintf_s failed";
UNREACHABLE();
}
// mantissa
buf[0] = bufTmp[1];
if (digits > 1) {
if (memcpy_s(buf + 1, digits, bufTmp + 2, digits) != EOK) { // 2 means add the point char to buf
- LOG_ECMA(FATAL) << "memcpy_s failed";
+ LOG_FULL(FATAL) << "memcpy_s failed";
UNREACHABLE();
}
}
diff --git a/ecmascript/base/string_helper.h b/ecmascript/base/string_helper.h
index b12404b061d31e5d360e7dfc78ceba439bb41c79..e355855d586344625300f0709fd40c1a366538b6 100644
--- a/ecmascript/base/string_helper.h
+++ b/ecmascript/base/string_helper.h
@@ -30,7 +30,6 @@
#include "ecmascript/js_thread.h"
#include "ecmascript/mem/assert_scope.h"
#include "ecmascript/object_factory.h"
-#include "libpandafile/file_items.h"
#include "unicode/unistr.h"
namespace panda::ecmascript::base {
@@ -40,9 +39,18 @@ static constexpr uint16_t SPACE_OR_LINE_TERMINAL[] = {
0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004,
0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F, 0x3000, 0xFEFF,
};
-
+static constexpr int UICODE_FROM_UTF8[] = {
+ 0x80, 0xc0, 0xdf, 0xe0, 0xef, 0xf0, 0xf7, 0xf8, 0xfb, 0xfc, 0xfd,
+};
+static constexpr int UTF8_MIN_CODE[] = {
+ 0x80, 0x800, 0x10000, 0x00200000, 0x04000000,
+};
+static constexpr char UTF8_FIRST_CODE[] = {
+ 0x1f, 0xf, 0x7, 0x3, 0x1,
+};
class StringHelper {
public:
+ static constexpr int INVALID_UNICODE_FROM_UTF8 = -1;
static std::string ToStdString(EcmaString *string);
static bool CheckDuplicate(EcmaString *string);
@@ -176,7 +184,51 @@ public:
static EcmaString *Repeat(JSThread *thread, const std::u16string &thisStr, int32_t repeatLen, bool canBeCompress);
- static EcmaString *Trim(JSThread *thread, const std::u16string &thisStr);
+ static int UnicodeFromUtf8(const uint8_t *p, int maxLen, const uint8_t **pp)
+ {
+ int c = *p++;
+ if (c < UICODE_FROM_UTF8[0]) {
+ *pp = p;
+ return c;
+ }
+ int l = 0;
+ if (c >= UICODE_FROM_UTF8[1] && c <= UICODE_FROM_UTF8[2]) { // 1 - 2: 0000 0080 - 0000 07FF
+ l = 1; // 1: 0000 0080 - 0000 07FF Unicode
+ } else if (c >= UICODE_FROM_UTF8[3] && c <= UICODE_FROM_UTF8[4]) { // 3 - 4: 0000 0800 - 0000 FFFF
+ l = 2; // 2: 0000 0800 - 0000 FFFF Unicode
+ } else if (c >= UICODE_FROM_UTF8[5] && c <= UICODE_FROM_UTF8[6]) { // 5 - 6: 0001 0000 - 0010 FFFF
+ l = 3; // 3: 0001 0000 - 0010 FFFF Unicode
+ } else if (c >= UICODE_FROM_UTF8[7] && c <= UICODE_FROM_UTF8[8]) { // 7 - 8: 0020 0000 - 03FF FFFF
+ l = 4; // 4: 0020 0000 - 03FF FFFF Unicode
+ } else if (c == UICODE_FROM_UTF8[9] || c == UICODE_FROM_UTF8[10]) { // 9 - 10: 0400 0000 - 7FFF FFFF
+ l = 5; // 5: 0400 0000 - 7FFF FFFF Unicode
+ } else {
+ return INVALID_UNICODE_FROM_UTF8;
+ }
+ /* check that we have enough characters */
+ if (l > (maxLen - 1)) {
+ return INVALID_UNICODE_FROM_UTF8;
+ }
+ return FromUtf8(c, l, p, pp);
+ }
+
+ static int FromUtf8(int c, int l, const uint8_t *p, const uint8_t **pp)
+ {
+ uint32_t b;
+ c &= UTF8_FIRST_CODE[l - 1];
+ for (int i = 0; i < l; i++) {
+ b = *p++;
+ if (b < utf_helper::UTF8_2B_SECOND || b >= utf_helper::UTF8_2B_FIRST) {
+ return INVALID_UNICODE_FROM_UTF8;
+ }
+ c = (c << 6) | (b & utf_helper::UTF8_2B_THIRD); // 6: Maximum Unicode range
+ }
+ if (c < UTF8_MIN_CODE[l - 1]) {
+ return INVALID_UNICODE_FROM_UTF8;
+ }
+ *pp = p;
+ return c;
+ }
static inline std::u16string Append(const std::u16string &str1, const std::u16string &str2)
{
@@ -203,18 +255,22 @@ public:
static inline std::string GetSpecifiedLine(const std::string &srcStr, int lineNumber)
{
- std::stringstream ss(srcStr);
- int count = 0;
- std::string lineStr = "";
- std::string tempLine;
- while (getline(ss, tempLine, '\n')) {
- count++;
- if (count == lineNumber) {
- lineStr = tempLine;
- break;
+ ASSERT(lineNumber >= 1);
+ int prePos = 0;
+ int findPrePos = lineNumber - 1;
+ for (int i = 0; i < findPrePos; i++) {
+ prePos = srcStr.find('\n', prePos);
+ if (prePos == -1) {
+ return "";
}
+ prePos += 1;
+ }
+ int findEndPos = srcStr.find('\n', prePos);
+ if (findEndPos == -1) {
+ return srcStr.substr(prePos, srcStr.length() - prePos);
}
- return lineStr;
+ ASSERT(findEndPos > prePos);
+ return srcStr.substr(prePos, findEndPos - prePos);
}
static inline bool IsNonspace(uint16_t c)
diff --git a/ecmascript/base/tests/builtins_base_test.cpp b/ecmascript/base/tests/builtins_base_test.cpp
index d9c678c5adb8c7033a65bfe2be3f40e38aa9bbbc..3725c52fb0a1017d9e2d2f98d2620ca2a2293849 100644
--- a/ecmascript/base/tests/builtins_base_test.cpp
+++ b/ecmascript/base/tests/builtins_base_test.cpp
@@ -59,14 +59,14 @@ public:
*/
HWTEST_F_L0(BuiltinsBaseTest, GetArgsArray)
{
- array_size_t argvLength = 10;
+ uint32_t argvLength = 10;
auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), argvLength);
ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(1));
ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(2));
ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(3));
- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get());
- JSHandle resultArray = BuiltinsBase::GetArgsArray(ecmaRuntimeCallInfo.get());
+ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo);
+ JSHandle resultArray = BuiltinsBase::GetArgsArray(ecmaRuntimeCallInfo);
TestHelper::TearDownFrame(thread, prev);
EXPECT_EQ(resultArray->GetLength(), 3U);
@@ -95,24 +95,24 @@ HWTEST_F_L0(BuiltinsBaseTest, BuiltinsBase_info_Get)
ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(ArgsPosition::FIRST));
ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(ArgsPosition::SECOND));
ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(ArgsPosition::FOURTH));
- [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get());
+ [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1);
- EXPECT_TRUE(BuiltinsBase::GetConstructor(ecmaRuntimeCallInfo1.get())->IsUndefined());
- EXPECT_TRUE(BuiltinsBase::GetNewTarget(ecmaRuntimeCallInfo1.get())->IsUndefined());
- EXPECT_EQ(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo1.get(), 0)->GetInt(), 0);
- EXPECT_EQ(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo1.get(), 1)->GetInt(), 1);
- EXPECT_EQ(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo1.get(), 2)->GetInt(), 3);
+ EXPECT_TRUE(BuiltinsBase::GetConstructor(ecmaRuntimeCallInfo1)->IsUndefined());
+ EXPECT_TRUE(BuiltinsBase::GetNewTarget(ecmaRuntimeCallInfo1)->IsUndefined());
+ EXPECT_EQ(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo1, 0)->GetInt(), 0);
+ EXPECT_EQ(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo1, 1)->GetInt(), 1);
+ EXPECT_EQ(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo1, 2)->GetInt(), 3);
TestHelper::TearDownFrame(thread, prev1);
auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*handleNewTarget), 6);
ecmaRuntimeCallInfo2->SetFunction(handleFunction.GetTaggedValue());
ecmaRuntimeCallInfo2->SetThis(handleNewTarget.GetTaggedValue());
ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue::Undefined());
- [[maybe_unused]] auto prev2 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get());
+ [[maybe_unused]] auto prev2 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2);
- EXPECT_TRUE(BuiltinsBase::GetConstructor(ecmaRuntimeCallInfo2.get())->IsJSFunction());
- EXPECT_TRUE(BuiltinsBase::GetNewTarget(ecmaRuntimeCallInfo2.get())->IsJSGlobalObject());
- EXPECT_TRUE(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo2.get(), 0)->IsUndefined());
+ EXPECT_TRUE(BuiltinsBase::GetConstructor(ecmaRuntimeCallInfo2)->IsJSFunction());
+ EXPECT_TRUE(BuiltinsBase::GetNewTarget(ecmaRuntimeCallInfo2)->IsJSGlobalObject());
+ EXPECT_TRUE(BuiltinsBase::GetCallArg(ecmaRuntimeCallInfo2, 0)->IsUndefined());
TestHelper::TearDownFrame(thread, prev2);
}
diff --git a/ecmascript/base/typed_array_helper.cpp b/ecmascript/base/typed_array_helper.cpp
index 1745b80509337d68c83cce8343580f0d5703f372..7d271a38597bbfc1e65e1fb844b93bf6083e9592 100644
--- a/ecmascript/base/typed_array_helper.cpp
+++ b/ecmascript/base/typed_array_helper.cpp
@@ -474,9 +474,10 @@ JSHandle TypedArrayHelper::TypedArrayCreate(JSThread *thread, const JS
{
// 1. Let newTypedArray be ? Construct(constructor, argumentList).
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info = EcmaInterpreter::NewRuntimeCallInfo(thread, constructor, undefined, undefined, argc);
- info.SetCallArg(argc, argv);
- JSTaggedValue taggedArray = JSFunction::Construct(&info);
+ EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, constructor, undefined, undefined, argc);
+ RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Exception()));
+ info->SetCallArg(argc, argv);
+ JSTaggedValue taggedArray = JSFunction::Construct(info);
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Exception()));
if (!taggedArray.IsECMAObject()) {
THROW_TYPE_ERROR_AND_RETURN(thread, "Failed to construct the Typedarray.",
@@ -491,7 +492,7 @@ JSHandle TypedArrayHelper::TypedArrayCreate(JSThread *thread, const JS
// a. If newTypedArray.[[ArrayLength]] < argumentList[0], throw a TypeError exception.
if (argc == 1) {
if (JSHandle::Cast(newTypedArray)->GetArrayLength() <
- JSTaggedValue::ToUint32(thread, info.GetCallArg(0))) {
+ JSTaggedValue::ToUint32(thread, info->GetCallArg(0))) {
THROW_TYPE_ERROR_AND_RETURN(thread, "the length of newTypedArray is not a correct value.",
JSHandle(thread, JSTaggedValue::Exception()));
}
@@ -533,12 +534,13 @@ int32_t TypedArrayHelper::SortCompare(JSThread *thread, const JSHandleIsUndefined()) {
- const size_t argsLength = 2;
+ const int32_t argsLength = 2;
JSHandle undefined = globalConst->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackfnHandle, undefined, undefined, argsLength);
- info.SetCallArg(firstValue.GetTaggedValue(), secondValue.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, 0);
+ info->SetCallArg(firstValue.GetTaggedValue(), secondValue.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, 0);
if (BuiltinsArrayBuffer::IsDetachedBuffer(buffer.GetTaggedValue())) {
THROW_TYPE_ERROR_AND_RETURN(thread, "The buffer is detached buffer.", 0);
diff --git a/ecmascript/base/utf_helper.h b/ecmascript/base/utf_helper.h
index 64df9d09cee292cdcc0a46a74cff76c875b9f2f0..858405d4bccbc114ff486035026cd1f6369cc743 100644
--- a/ecmascript/base/utf_helper.h
+++ b/ecmascript/base/utf_helper.h
@@ -40,6 +40,7 @@ static constexpr uint8_t UTF8_1B_MAX = 0x7f;
static constexpr uint16_t UTF8_2B_MAX = 0x7ff;
static constexpr uint8_t UTF8_2B_FIRST = 0xc0;
static constexpr uint8_t UTF8_2B_SECOND = 0x80;
+static constexpr uint8_t UTF8_2B_THIRD = 0x3f;
static constexpr uint8_t UTF8_3B_FIRST = 0xe0;
static constexpr uint8_t UTF8_3B_SECOND = 0x80;
diff --git a/ecmascript/builtins.cpp b/ecmascript/builtins.cpp
index 38242dcb997aeaf6c2155b0aab0bb0d0bb82670d..37eca9aeffdee5331972289faf93a23c68c2ad92 100644
--- a/ecmascript/builtins.cpp
+++ b/ecmascript/builtins.cpp
@@ -16,7 +16,6 @@
#include "ecmascript/builtins.h"
#ifdef PANDA_TARGET_WINDOWS
-#include "shlwapi.h"
#ifdef ERROR
#undef ERROR
#endif
@@ -33,9 +32,9 @@
#include "ecmascript/builtins/builtins_atomics.h"
#include "ecmascript/builtins/builtins_bigint.h"
#include "ecmascript/builtins/builtins_boolean.h"
-#include "ecmascript/builtins/builtin_cjs_module.h"
-#include "ecmascript/builtins/builtin_cjs_require.h"
-#include "ecmascript/builtins/builtin_cjs_exports.h"
+#include "ecmascript/builtins/builtins_cjs_module.h"
+#include "ecmascript/builtins/builtins_cjs_require.h"
+#include "ecmascript/builtins/builtins_cjs_exports.h"
#include "ecmascript/builtins/builtins_collator.h"
#include "ecmascript/builtins/builtins_dataview.h"
#include "ecmascript/builtins/builtins_date.h"
@@ -75,6 +74,7 @@
#include "ecmascript/builtins/builtins_weak_set.h"
#include "ecmascript/containers/containers_private.h"
#include "ecmascript/ecma_runtime_call_info.h"
+#include "ecmascript/file_loader.h"
#include "ecmascript/js_array.h"
#include "ecmascript/js_arraybuffer.h"
#include "ecmascript/js_array_iterator.h"
@@ -138,6 +138,7 @@ using Error = builtins::BuiltinsError;
using RangeError = builtins::BuiltinsRangeError;
using ReferenceError = builtins::BuiltinsReferenceError;
using TypeError = builtins::BuiltinsTypeError;
+using AggregateError = builtins::BuiltinsAggregateError;
using URIError = builtins::BuiltinsURIError;
using SyntaxError = builtins::BuiltinsSyntaxError;
using EvalError = builtins::BuiltinsEvalError;
@@ -169,40 +170,13 @@ using Collator = builtins::BuiltinsCollator;
using PluralRules = builtins::BuiltinsPluralRules;
using DisplayNames = builtins::BuiltinsDisplayNames;
using ListFormat = builtins::BuiltinsListFormat;
-using CjsModule = builtins::BuiltinsCjsModule;
-using CjsExports = builtins::BuiltinsCjsExports;
-using CjsRequire = builtins::BuiltinsCjsRequire;
+using BuiltinsCjsModule = builtins::BuiltinsCjsModule;
+using BuiltinsCjsExports = builtins::BuiltinsCjsExports;
+using BuiltinsCjsRequire = builtins::BuiltinsCjsRequire;
using ContainersPrivate = containers::ContainersPrivate;
using SharedArrayBuffer = builtins::BuiltinsSharedArrayBuffer;
-bool GetAbsolutePath(const std::string &relativePath, std::string &absPath)
-{
- if (relativePath.size() >= PATH_MAX) {
- return false;
- }
- char buffer[PATH_MAX] = {0};
-#ifndef PANDA_TARGET_WINDOWS
- auto path = realpath(relativePath.c_str(), buffer);
- if (path == nullptr) {
- return false;
- }
- absPath = std::string(path);
- return true;
-#else
- auto path = _fullpath(buffer, relativePath.c_str(), sizeof(buffer) - 1);
- if (path == nullptr) {
- return false;
- }
- bool valid = PathCanonicalizeA(buffer, path);
- if (!valid) {
- return false;
- }
- absPath = std::string(buffer);
- return true;
-#endif
-}
-
void Builtins::Initialize(const JSHandle &env, JSThread *thread)
{
thread_ = thread;
@@ -253,25 +227,6 @@ void Builtins::Initialize(const JSHandle &env, JSThread *thread)
JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION, env->GetFunctionPrototype());
env->SetAsyncAwaitStatusFunctionClass(thread_, asyncAwaitStatusFuncClass);
- JSHandle promiseReactionFuncClass = factory_->NewEcmaDynClass(
- JSPromiseReactionsFunction::SIZE, JSType::JS_PROMISE_REACTIONS_FUNCTION, env->GetFunctionPrototype());
- promiseReactionFuncClass->SetCallable(true);
- promiseReactionFuncClass->SetExtensible(true);
- env->SetPromiseReactionFunctionClass(thread_, promiseReactionFuncClass);
-
- JSHandle promiseExecutorFuncClass = factory_->NewEcmaDynClass(
- JSPromiseExecutorFunction::SIZE, JSType::JS_PROMISE_EXECUTOR_FUNCTION, env->GetFunctionPrototype());
- promiseExecutorFuncClass->SetCallable(true);
- promiseExecutorFuncClass->SetExtensible(true);
- env->SetPromiseExecutorFunctionClass(thread_, promiseExecutorFuncClass);
-
- JSHandle promiseAllResolveElementFunctionClass =
- factory_->NewEcmaDynClass(JSPromiseAllResolveElementFunction::SIZE,
- JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION, env->GetFunctionPrototype());
- promiseAllResolveElementFunctionClass->SetCallable(true);
- promiseAllResolveElementFunctionClass->SetExtensible(true);
- env->SetPromiseAllResolveElementFunctionClass(thread_, promiseAllResolveElementFunctionClass);
-
JSHandle proxyRevocFuncClass = factory_->NewEcmaDynClass(
JSProxyRevocFunction::SIZE, JSType::JS_PROXY_REVOC_FUNCTION, env->GetFunctionPrototype());
proxyRevocFuncClass->SetCallable(true);
@@ -281,7 +236,6 @@ void Builtins::Initialize(const JSHandle &env, JSThread *thread)
// Object = new Function()
JSHandle objectFunction(
NewBuiltinConstructor(env, objFuncPrototype, Object::ObjectConstructor, "Object", FunctionLength::ONE));
- objectFunction.GetObject()->SetBuiltinsCtorMode();
objectFunction.GetObject()->SetFunctionPrototype(thread_, objFuncDynclass.GetTaggedValue());
// initialize object method.
env->SetObjectFunction(thread_, objectFunction);
@@ -372,8 +326,7 @@ void Builtins::InitializeForSnapshot(JSThread *thread)
InitializeIcuData();
// Initialize ArkTools
- JSRuntimeOptions options = vm_->GetJSOptions();
- if (options.EnableArkTools()) {
+ if (vm_->GetJSOptions().EnableArkTools()) {
auto env = vm_->GetGlobalEnv();
auto globalObject = JSHandle::Cast(env->GetJSGlobalObject());
JSHandle arkTools(InitializeArkTools(env));
@@ -392,8 +345,7 @@ void Builtins::InitializeGlobalObject(const JSHandle &env, const JSHa
SetFunction(env, globalObject, "stopRuntimeStat", Global::StopRuntimeStat, 0);
#endif
- JSRuntimeOptions options = vm_->GetJSOptions();
- if (options.EnableArkTools()) {
+ if (vm_->GetJSOptions().EnableArkTools()) {
JSHandle arkTools(InitializeArkTools(env));
SetConstantObject(globalObject, "ArkTools", arkTools);
}
@@ -439,8 +391,6 @@ void Builtins::InitializeFunction(const JSHandle &env, const JSHandle
JSHandle funcFuncIntanceDynclass =
factory_->NewEcmaDynClass(JSFunction::SIZE, JSType::JS_FUNCTION, funcFuncPrototypeValue);
funcFuncIntanceDynclass->SetConstructor(true);
- JSHandle function = JSHandle::Cast(factory_->NewJSObjectWithInit(funcFuncIntanceDynclass));
- function->SetBuiltinsCtorMode();
// Function = new Function() (forbidden use NewBuiltinConstructor)
JSHandle funcFunc =
@@ -466,9 +416,6 @@ void Builtins::InitializeFunction(const JSHandle &env, const JSHandle
JSHandle constructorFunctionClass =
factory_->NewEcmaDynClass(JSFunction::SIZE, JSType::JS_FUNCTION, env->GetFunctionPrototype());
constructorFunctionClass->SetConstructor(true);
- JSHandle functionConstructor =
- JSHandle::Cast(factory_->NewJSObjectWithInit(constructorFunctionClass));
- functionConstructor->SetBuiltinsCtorMode();
env->SetConstructorFunctionClass(thread_, constructorFunctionClass);
StrictModeForbiddenAccessCallerArguments(env, funcFuncPrototypeObj);
@@ -518,6 +465,8 @@ void Builtins::InitializeObject(const JSHandle &env, const JSHandle &env, const JSHandle &env, const JSHandle &objFuncDynclass) const
{
[[maybe_unused]] EcmaHandleScope scope(thread_);
- const int utcLength = 7;
+ constexpr int utcLength = 7;
// Date.prototype
JSHandle dateFuncPrototype = factory_->NewJSObjectWithInit(objFuncDynclass);
JSHandle dateFuncPrototypeValue(dateFuncPrototype);
@@ -1015,8 +964,6 @@ void Builtins::InitializeAllTypeError(const JSHandle &env, const JSHa
JSHandle nativeErrorFuncClass =
factory_->NewEcmaDynClass(JSFunction::SIZE, JSType::JS_FUNCTION, env->GetErrorFunction());
nativeErrorFuncClass->SetConstructor(true);
- JSHandle function = JSHandle::Cast(factory_->NewJSObjectWithInit(nativeErrorFuncClass));
- function->SetBuiltinsCtorMode();
env->SetNativeErrorFunctionClass(thread_, nativeErrorFuncClass);
JSHandle errorNativeFuncInstanceDynclass =
@@ -1024,6 +971,7 @@ void Builtins::InitializeAllTypeError(const JSHandle &env, const JSHa
InitializeError(env, errorNativeFuncInstanceDynclass, JSType::JS_RANGE_ERROR);
InitializeError(env, errorNativeFuncInstanceDynclass, JSType::JS_REFERENCE_ERROR);
InitializeError(env, errorNativeFuncInstanceDynclass, JSType::JS_TYPE_ERROR);
+ InitializeError(env, errorNativeFuncInstanceDynclass, JSType::JS_AGGREGATE_ERROR);
InitializeError(env, errorNativeFuncInstanceDynclass, JSType::JS_URI_ERROR);
InitializeError(env, errorNativeFuncInstanceDynclass, JSType::JS_SYNTAX_ERROR);
InitializeError(env, errorNativeFuncInstanceDynclass, JSType::JS_EVAL_ERROR);
@@ -1039,6 +987,7 @@ void Builtins::InitializeAllTypeErrorWithRealm(const JSHandle &realm)
SetErrorWithRealm(realm, JSType::JS_RANGE_ERROR);
SetErrorWithRealm(realm, JSType::JS_REFERENCE_ERROR);
SetErrorWithRealm(realm, JSType::JS_TYPE_ERROR);
+ SetErrorWithRealm(realm, JSType::JS_AGGREGATE_ERROR);
SetErrorWithRealm(realm, JSType::JS_URI_ERROR);
SetErrorWithRealm(realm, JSType::JS_SYNTAX_ERROR);
SetErrorWithRealm(realm, JSType::JS_EVAL_ERROR);
@@ -1072,6 +1021,11 @@ void Builtins::SetErrorWithRealm(const JSHandle &realm, const JSType
realm->SetTypeErrorFunction(thread_, nativeErrorFunction);
realm->SetThrowTypeError(thread_, env->GetThrowTypeError());
break;
+ case JSType::JS_AGGREGATE_ERROR:
+ nativeErrorFunction = env->GetAggregateErrorFunction();
+ nameString = JSHandle(thread_->GlobalConstants()->GetHandledAggregateErrorString());
+ realm->SetAggregateErrorFunction(thread_, nativeErrorFunction);
+ break;
case JSType::JS_URI_ERROR:
nativeErrorFunction = env->GetURIErrorFunction();
nameString = JSHandle(thread_->GlobalConstants()->GetHandledURIErrorString());
@@ -1124,6 +1078,10 @@ void Builtins::InitializeError(const JSHandle &env, const JSHandle &env, const JSHandleNewEcmaDynClass(JSObject::SIZE, errorParameter.nativeJstype, nativeErrorFuncPrototypeValue);
// NativeError() = new Error()
+ FunctionLength functionLength = FunctionLength::ONE;
+ if (errorTag == JSType::JS_AGGREGATE_ERROR) {
+ functionLength = FunctionLength::TWO;
+ }
JSHandle nativeErrorFunction =
factory_->NewJSNativeErrorFunction(env, reinterpret_cast(errorParameter.nativeConstructor));
InitializeCtor(env, nativeErrorFuncPrototype, nativeErrorFunction, errorParameter.nativePropertyName,
- FunctionLength::ONE);
+ functionLength);
nativeErrorFunction->SetFunctionPrototype(thread_, nativeErrorFuncInstanceDynclass.GetTaggedValue());
@@ -1167,6 +1129,8 @@ void Builtins::InitializeError(const JSHandle &env, const JSHandle::Cast(throwTypeErrorFunction));
env->SetThrowTypeError(thread_, throwTypeErrorFunction);
+ } else if (errorTag == JSType::JS_AGGREGATE_ERROR) {
+ env->SetAggregateErrorFunction(thread_, nativeErrorFunction);
} else if (errorTag == JSType::JS_URI_ERROR) {
env->SetURIErrorFunction(thread_, nativeErrorFunction);
} else if (errorTag == JSType::JS_SYNTAX_ERROR) {
@@ -1592,6 +1556,7 @@ void Builtins::InitializeString(const JSHandle &env, const JSHandle &env, const JSHandle(arrayFunction), speciesSymbol, speciesGetter);
- const int arrProtoLen = 0;
+ constexpr int arrProtoLen = 0;
JSHandle key_string = thread_->GlobalConstants()->GetHandledLengthString();
PropertyDescriptor descriptor(thread_, JSHandle(thread_, JSTaggedValue(arrProtoLen)), true, false,
false);
@@ -2026,9 +1991,6 @@ void Builtins::InitializeTypedArray(const JSHandle &env, const JSHand
JSHandle specificTypedArrayFuncClass =
factory_->NewEcmaDynClass(JSFunction::SIZE, JSType::JS_FUNCTION, env->GetTypedArrayFunction());
specificTypedArrayFuncClass->SetConstructor(true);
- JSHandle function =
- JSHandle::Cast(factory_->NewJSObjectWithInit(specificTypedArrayFuncClass));
- function->SetBuiltinsCtorMode();
env->SetSpecificTypedArrayFunctionClass(thread_, specificTypedArrayFuncClass);
InitializeInt8Array(env, typedArrFuncInstanceDynclass);
@@ -2062,7 +2024,7 @@ void Builtins::InitializeInt8Array(const JSHandle &env, const JSHandl
int8ArrayFunction->SetProtoOrDynClass(thread_, int8ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 1;
+ constexpr int bytesPerElement = 1;
SetConstant(int8ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(int8ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetInt8ArrayFunction(thread_, int8ArrayFunction);
@@ -2086,7 +2048,7 @@ void Builtins::InitializeUint8Array(const JSHandle &env, const JSHand
uint8ArrayFunction->SetProtoOrDynClass(thread_, uint8ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 1;
+ constexpr int bytesPerElement = 1;
SetConstant(uint8ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(uint8ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetUint8ArrayFunction(thread_, uint8ArrayFunction);
@@ -2113,7 +2075,7 @@ void Builtins::InitializeUint8ClampedArray(const JSHandle &env,
uint8ClampedArrayFunction->SetProtoOrDynClass(thread_, uint8ClampedArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 1;
+ constexpr int bytesPerElement = 1;
SetConstant(uint8ClampedArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(uint8ClampedArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetUint8ClampedArrayFunction(thread_, uint8ClampedArrayFunction);
@@ -2137,7 +2099,7 @@ void Builtins::InitializeInt16Array(const JSHandle &env, const JSHand
int16ArrayFunction->SetProtoOrDynClass(thread_, int16ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 2;
+ constexpr int bytesPerElement = 2;
SetConstant(int16ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(int16ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetInt16ArrayFunction(thread_, int16ArrayFunction);
@@ -2161,7 +2123,7 @@ void Builtins::InitializeUint16Array(const JSHandle &env, const JSHan
uint16ArrayFunction->SetProtoOrDynClass(thread_, uint16ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 2;
+ constexpr int bytesPerElement = 2;
SetConstant(uint16ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(uint16ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetUint16ArrayFunction(thread_, uint16ArrayFunction);
@@ -2185,7 +2147,7 @@ void Builtins::InitializeInt32Array(const JSHandle &env, const JSHand
int32ArrayFunction->SetProtoOrDynClass(thread_, int32ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 4;
+ constexpr int bytesPerElement = 4;
SetConstant(int32ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(int32ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetInt32ArrayFunction(thread_, int32ArrayFunction);
@@ -2209,7 +2171,7 @@ void Builtins::InitializeUint32Array(const JSHandle &env, const JSHan
uint32ArrayFunction->SetProtoOrDynClass(thread_, uint32ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 4;
+ constexpr int bytesPerElement = 4;
SetConstant(uint32ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(uint32ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetUint32ArrayFunction(thread_, uint32ArrayFunction);
@@ -2233,7 +2195,7 @@ void Builtins::InitializeFloat32Array(const JSHandle &env, const JSHa
float32ArrayFunction->SetProtoOrDynClass(thread_, float32ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 4;
+ constexpr int bytesPerElement = 4;
SetConstant(float32ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(float32ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetFloat32ArrayFunction(thread_, float32ArrayFunction);
@@ -2257,7 +2219,7 @@ void Builtins::InitializeFloat64Array(const JSHandle &env, const JSHa
float64ArrayFunction->SetProtoOrDynClass(thread_, float64ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 8;
+ constexpr int bytesPerElement = 8;
SetConstant(float64ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(float64ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetFloat64ArrayFunction(thread_, float64ArrayFunction);
@@ -2281,7 +2243,7 @@ void Builtins::InitializeBigInt64Array(const JSHandle &env, const JSH
bigInt64ArrayFunction->SetProtoOrDynClass(thread_, bigInt64ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 8;
+ constexpr int bytesPerElement = 8;
SetConstant(bigInt64ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(bigInt64ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetBigInt64ArrayFunction(thread_, bigInt64ArrayFunction);
@@ -2305,7 +2267,7 @@ void Builtins::InitializeBigUint64Array(const JSHandle &env, const JS
bigUint64ArrayFunction->SetProtoOrDynClass(thread_, bigUint64ArrFuncInstanceDynclass.GetTaggedValue());
- const int bytesPerElement = 8;
+ constexpr int bytesPerElement = 8;
SetConstant(bigUint64ArrFuncPrototype, "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
SetConstant(JSHandle(bigUint64ArrayFunction), "BYTES_PER_ELEMENT", JSTaggedValue(bytesPerElement));
env->SetBigUint64ArrayFunction(thread_, bigUint64ArrayFunction);
@@ -2451,10 +2413,13 @@ void Builtins::InitializePromise(const JSHandle &env, const JSHandle<
SetFunction(env, promiseFunction, "race", Promise::Race, FunctionLength::ONE);
SetFunction(env, promiseFunction, "resolve", Promise::Resolve, FunctionLength::ONE);
SetFunction(env, promiseFunction, "reject", Promise::Reject, FunctionLength::ONE);
+ SetFunction(env, promiseFunction, "any", Promise::Any, FunctionLength::ONE);
+ SetFunction(env, promiseFunction, "allSettled", Promise::AllSettled, FunctionLength::ONE);
// promise.prototype method
SetFunction(env, promiseFuncPrototype, "catch", Promise::Catch, FunctionLength::ONE);
SetFunction(env, promiseFuncPrototype, "then", Promise::Then, FunctionLength::TWO);
+ SetFunction(env, promiseFuncPrototype, "finally", Promise::Finally, FunctionLength::ONE);
// Promise.prototype [ @@toStringTag ]
SetStringTagSymbol(env, promiseFuncPrototype, "Promise");
@@ -2466,6 +2431,61 @@ void Builtins::InitializePromise(const JSHandle &env, const JSHandle<
SetGetter(promiseFunction, speciesSymbol, speciesGetter);
env->SetPromiseFunction(thread_, promiseFunction);
+ InitializeForPromiseFuncClass(env);
+}
+
+
+void Builtins::InitializeForPromiseFuncClass(const JSHandle &env)
+{
+ vm_ = thread_->GetEcmaVM();
+ factory_ = vm_->GetFactory();
+
+ JSHandle promiseReactionFuncClass = factory_->NewEcmaDynClass(
+ JSPromiseReactionsFunction::SIZE, JSType::JS_PROMISE_REACTIONS_FUNCTION, env->GetFunctionPrototype());
+ promiseReactionFuncClass->SetCallable(true);
+ promiseReactionFuncClass->SetExtensible(true);
+ env->SetPromiseReactionFunctionClass(thread_, promiseReactionFuncClass);
+
+ JSHandle promiseExecutorFuncClass = factory_->NewEcmaDynClass(
+ JSPromiseExecutorFunction::SIZE, JSType::JS_PROMISE_EXECUTOR_FUNCTION, env->GetFunctionPrototype());
+ promiseExecutorFuncClass->SetCallable(true);
+ promiseExecutorFuncClass->SetExtensible(true);
+ env->SetPromiseExecutorFunctionClass(thread_, promiseExecutorFuncClass);
+
+ JSHandle promiseAllResolveElementFunctionClass =
+ factory_->NewEcmaDynClass(JSPromiseAllResolveElementFunction::SIZE,
+ JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION, env->GetFunctionPrototype());
+ promiseAllResolveElementFunctionClass->SetCallable(true);
+ promiseAllResolveElementFunctionClass->SetExtensible(true);
+ env->SetPromiseAllResolveElementFunctionClass(thread_, promiseAllResolveElementFunctionClass);
+
+ JSHandle promiseAnyRejectElementFunctionClass =
+ factory_->NewEcmaDynClass(JSPromiseAnyRejectElementFunction::SIZE,
+ JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION, env->GetFunctionPrototype());
+ promiseAnyRejectElementFunctionClass->SetCallable(true);
+ promiseAnyRejectElementFunctionClass->SetExtensible(true);
+ env->SetPromiseAnyRejectElementFunctionClass(thread_, promiseAnyRejectElementFunctionClass);
+
+ JSHandle promiseAllSettledElementFunctionClass =
+ factory_->NewEcmaDynClass(JSPromiseAllSettledElementFunction::SIZE,
+ JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION, env->GetFunctionPrototype());
+ promiseAllSettledElementFunctionClass->SetCallable(true);
+ promiseAllSettledElementFunctionClass->SetExtensible(true);
+ env->SetPromiseAllSettledElementFunctionClass(thread_, promiseAllSettledElementFunctionClass);
+
+ JSHandle promiseFinallyFunctionClass =
+ factory_->NewEcmaDynClass(JSPromiseFinallyFunction::SIZE,
+ JSType::JS_PROMISE_FINALLY_FUNCTION, env->GetFunctionPrototype());
+ promiseFinallyFunctionClass->SetCallable(true);
+ promiseFinallyFunctionClass->SetExtensible(true);
+ env->SetPromiseFinallyFunctionClass(thread_, promiseFinallyFunctionClass);
+
+ JSHandle promiseValueThunkOrThrowerFunctionClass =
+ factory_->NewEcmaDynClass(JSPromiseValueThunkOrThrowerFunction::SIZE,
+ JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION, env->GetFunctionPrototype());
+ promiseValueThunkOrThrowerFunctionClass->SetCallable(true);
+ promiseValueThunkOrThrowerFunctionClass->SetExtensible(true);
+ env->SetPromiseValueThunkOrThrowerFunctionClass(thread_, promiseValueThunkOrThrowerFunctionClass);
}
void Builtins::InitializePromiseJob(const JSHandle &env)
@@ -3211,7 +3231,9 @@ JSHandle Builtins::InitializeArkTools(const JSHandle &env)
JSHandle tools = factory_->NewEmptyJSObject();
SetFunction(env, tools, "print", builtins::BuiltinsArkTools::ObjectDump, FunctionLength::ZERO);
SetFunction(env, tools, "compareHClass", builtins::BuiltinsArkTools::CompareHClass, FunctionLength::TWO);
- SetFunction(env, tools, "DumpHClass", builtins::BuiltinsArkTools::DumpHClass, FunctionLength::ONE);
+ SetFunction(env, tools, "dumpHClass", builtins::BuiltinsArkTools::DumpHClass, FunctionLength::ONE);
+ SetFunction(env, tools, "isTSHClass", builtins::BuiltinsArkTools::IsTSHClass, FunctionLength::ONE);
+ SetFunction(env, tools, "getHClass", builtins::BuiltinsArkTools::GetHClass, FunctionLength::ONE);
return tools;
}
@@ -3265,23 +3287,24 @@ void Builtins::InitializeCjsModule(const JSHandle &env) const
// CjsModule.prototype_or_dynclass
JSHandle cjsModuleDynclass =
- factory_->NewEcmaDynClass(JSCjsModule::SIZE, JSType::JS_CJS_MODULE, cjsModulePrototypeValue);
+ factory_->NewEcmaDynClass(CjsModule::SIZE, JSType::JS_CJS_MODULE, cjsModulePrototypeValue);
// CjsModule.prototype.Constructor
JSHandle cjsModuleFunction(
- NewBuiltinCjsCtor(env, cjsModulePrototype, CjsModule::CjsModuleConstructor, "Module", FunctionLength::TWO));
+ NewBuiltinCjsCtor(env, cjsModulePrototype, BuiltinsCjsModule::CjsModuleConstructor, "Module",
+ FunctionLength::TWO));
JSHandle(cjsModuleFunction)->SetFunctionPrototype(thread_, cjsModuleDynclass.GetTaggedValue());
// CjsModule method
- SetFunction(env, cjsModuleFunction, "_load", CjsModule::Load, FunctionLength::ONE);
- SetFunction(env, cjsModuleFunction, "_resolveFilename", CjsModule::ResolveFilename, FunctionLength::ONE);
+ SetFunction(env, cjsModuleFunction, "_load", BuiltinsCjsModule::Load, FunctionLength::ONE);
+ SetFunction(env, cjsModuleFunction, "_resolveFilename", BuiltinsCjsModule::ResolveFilename, FunctionLength::ONE);
// CjsModule.prototype method
- SetFunction(env, cjsModulePrototype, "require", CjsModule::Require, FunctionLength::ONE);
+ SetFunction(env, cjsModulePrototype, "require", BuiltinsCjsModule::Require, FunctionLength::ONE);
SetFunction(env, cjsModulePrototype, "getExportsForCircularRequire",
- CjsModule::GetExportsForCircularRequire, FunctionLength::ONE);
- SetFunction(env, cjsModulePrototype, "updateChildren", CjsModule::UpdateChildren, FunctionLength::ONE);
+ BuiltinsCjsModule::GetExportsForCircularRequire, FunctionLength::ONE);
+ SetFunction(env, cjsModulePrototype, "updateChildren", BuiltinsCjsModule::UpdateChildren, FunctionLength::ONE);
JSHandle id(thread_->GlobalConstants()->GetHandledEmptyString());
JSHandle path(thread_->GlobalConstants()->GetHandledEmptyString());
@@ -3319,11 +3342,11 @@ void Builtins::InitializeCjsExports(const JSHandle &env) const
// CjsExports.prototype_or_dynclass
JSHandle cjsExportsDynclass =
- factory_->NewEcmaDynClass(JSCjsExports::SIZE, JSType::JS_CJS_EXPORTS, cjsExportsPrototypeValue);
+ factory_->NewEcmaDynClass(CjsExports::SIZE, JSType::JS_CJS_EXPORTS, cjsExportsPrototypeValue);
// CjsExports.prototype.Constructor
JSHandle cjsExportsFunction(
- NewBuiltinCjsCtor(env, cjsExportsPrototype, CjsExports::CjsExportsConstructor, "Exports",
+ NewBuiltinCjsCtor(env, cjsExportsPrototype, BuiltinsCjsExports::CjsExportsConstructor, "Exports",
FunctionLength::TWO));
JSHandle(cjsExportsFunction)->SetFunctionPrototype(thread_, cjsExportsDynclass.GetTaggedValue());
@@ -3341,15 +3364,16 @@ void Builtins::InitializeCjsRequire(const JSHandle &env) const
// CjsExports.prototype_or_dynclass
JSHandle cjsRequireDynclass =
- factory_->NewEcmaDynClass(JSCjsRequire::SIZE, JSType::JS_CJS_REQUIRE, cjsRequirePrototypeValue);
+ factory_->NewEcmaDynClass(CjsRequire::SIZE, JSType::JS_CJS_REQUIRE, cjsRequirePrototypeValue);
// CjsExports.prototype.Constructor
JSHandle cjsRequireFunction =
- NewBuiltinCjsCtor(env, cjsRequirePrototype, CjsRequire::CjsRequireConstructor, "require", FunctionLength::ONE);
+ NewBuiltinCjsCtor(env, cjsRequirePrototype, BuiltinsCjsRequire::CjsRequireConstructor, "require",
+ FunctionLength::ONE);
JSHandle(cjsRequireFunction)->SetFunctionPrototype(thread_, cjsRequireDynclass.GetTaggedValue());
// CjsModule.prototype method
- SetFunction(env, cjsRequirePrototype, "Main", builtins::BuiltinsCjsRequire::Main, FunctionLength::ONE);
+ SetFunction(env, cjsRequirePrototype, "Main", BuiltinsCjsRequire::Main, FunctionLength::ONE);
env->SetCjsRequireFunction(thread_, cjsRequireFunction);
}
@@ -3365,7 +3389,7 @@ void Builtins::InitializeIcuData()
}
} else {
std::string absPath;
- if (GetAbsolutePath(icuPath, absPath)) {
+ if (FileLoader::GetAbsolutePath(icuPath, absPath)) {
u_setDataDirectory(absPath.c_str());
}
}
diff --git a/ecmascript/builtins.h b/ecmascript/builtins.h
index 4740646460d54487e65c6097c4f871af6e9dd383..ee0de854e780b587cc3068e9fc65ec0938da2c6a 100644
--- a/ecmascript/builtins.h
+++ b/ecmascript/builtins.h
@@ -180,6 +180,8 @@ private:
void InitializeDataView(const JSHandle &env, const JSHandle &objFuncDynclass) const;
+ void InitializeForPromiseFuncClass(const JSHandle &env);
+
void InitializeProxy(const JSHandle &env);
void InitializeReflect(const JSHandle &env, const JSHandle &objFuncPrototypeVal) const;
diff --git a/ecmascript/builtins/builtins_ark_tools.cpp b/ecmascript/builtins/builtins_ark_tools.cpp
index 48dcd7adadda7e971de3b2aa6d2ab2e051dc8c1e..7429df01c138b3ec6708e84b8a2fb4b1c4bd87da 100644
--- a/ecmascript/builtins/builtins_ark_tools.cpp
+++ b/ecmascript/builtins/builtins_ark_tools.cpp
@@ -19,60 +19,85 @@
namespace panda::ecmascript::builtins {
using StringHelper = base::StringHelper;
-JSTaggedValue BuiltinsArkTools::ObjectDump(EcmaRuntimeCallInfo *msg)
+JSTaggedValue BuiltinsArkTools::ObjectDump(EcmaRuntimeCallInfo *info)
{
- ASSERT(msg);
- JSThread *thread = msg->GetThread();
+ ASSERT(info);
+ JSThread *thread = info->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- JSHandle str = JSTaggedValue::ToString(thread, GetCallArg(msg, 0));
+ JSHandle str = JSTaggedValue::ToString(thread, GetCallArg(info, 0));
// The default log level of ace_engine and js_runtime is error
- LOG(ERROR, RUNTIME) << ": " << base::StringHelper::ToStdString(*str);
+ LOG_ECMA(ERROR) << ": " << base::StringHelper::ToStdString(*str);
- uint32_t numArgs = msg->GetArgsNumber();
- for (uint32_t i = 1; i < numArgs; i++) {
- JSHandle obj = GetCallArg(msg, i);
+ int32_t numArgs = info->GetArgsNumber();
+ for (int32_t i = 1; i < numArgs; i++) {
+ JSHandle obj = GetCallArg(info, i);
std::ostringstream oss;
obj->Dump(oss);
// The default log level of ace_engine and js_runtime is error
- LOG(ERROR, RUNTIME) << ": " << oss.str();
+ LOG_ECMA(ERROR) << ": " << oss.str();
}
return JSTaggedValue::Undefined();
}
-JSTaggedValue BuiltinsArkTools::CompareHClass(EcmaRuntimeCallInfo *msg)
+JSTaggedValue BuiltinsArkTools::CompareHClass(EcmaRuntimeCallInfo *info)
{
- ASSERT(msg);
- JSThread *thread = msg->GetThread();
+ ASSERT(info);
+ JSThread *thread = info->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- JSHandle obj1 = GetCallArg(msg, 0);
- JSHandle obj2 = GetCallArg(msg, 1);
+ JSHandle obj1 = GetCallArg(info, 0);
+ JSHandle obj2 = GetCallArg(info, 1);
JSHClass* obj1Hclass = obj1->GetTaggedObject()->GetClass();
JSHClass* obj2Hclass = obj2->GetTaggedObject()->GetClass();
std::ostringstream oss;
obj1Hclass->Dump(oss);
bool res = (obj1Hclass == obj2Hclass);
if (!res) {
- LOG(ERROR, RUNTIME) << "These two object don't share the same hclass:" << oss.str();
+ LOG_ECMA(ERROR) << "These two object don't share the same hclass:" << oss.str();
}
return JSTaggedValue(res);
}
-JSTaggedValue BuiltinsArkTools::DumpHClass(EcmaRuntimeCallInfo *msg)
+JSTaggedValue BuiltinsArkTools::DumpHClass(EcmaRuntimeCallInfo *info)
{
- ASSERT(msg);
- JSThread *thread = msg->GetThread();
+ ASSERT(info);
+ JSThread *thread = info->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- JSHandle obj = GetCallArg(msg, 0);
+ JSHandle obj = GetCallArg(info, 0);
JSHClass* objHclass = obj->GetTaggedObject()->GetClass();
std::ostringstream oss;
objHclass->Dump(oss);
- LOG(ERROR, RUNTIME) << "hclass:" << oss.str();
+ LOG_ECMA(ERROR) << "hclass:" << oss.str();
return JSTaggedValue::Undefined();
}
+
+JSTaggedValue BuiltinsArkTools::IsTSHClass(EcmaRuntimeCallInfo *info)
+{
+ ASSERT(info);
+ JSThread *thread = info->GetThread();
+ [[maybe_unused]] EcmaHandleScope handleScope(thread);
+
+ ASSERT(info->GetArgsNumber() == 1);
+ JSHandle object = GetCallArg(info, 0);
+ JSHClass* hclass = object->GetTaggedObject()->GetClass();
+ bool isTSHClass = hclass->IsTSType();
+ return GetTaggedBoolean(isTSHClass);
+}
+
+JSTaggedValue BuiltinsArkTools::GetHClass(EcmaRuntimeCallInfo *info)
+{
+ ASSERT(info);
+ JSThread *thread = info->GetThread();
+ [[maybe_unused]] EcmaHandleScope handleScope(thread);
+
+ ASSERT(info->GetArgsNumber() == 1);
+ JSHandle object = GetCallArg(info, 0);
+ JSHClass* hclass = object->GetTaggedObject()->GetClass();
+ return JSTaggedValue(hclass);
+}
} // namespace panda::ecmascript::builtins
diff --git a/ecmascript/builtins/builtins_ark_tools.h b/ecmascript/builtins/builtins_ark_tools.h
index 2403cb611d023ff3b14acf3e323546c13e2527dc..75a0d1d5134f4b52e7c5aa350698c5f0be7a5b15 100644
--- a/ecmascript/builtins/builtins_ark_tools.h
+++ b/ecmascript/builtins/builtins_ark_tools.h
@@ -24,11 +24,16 @@ class BuiltinsArkTools : public base::BuiltinsBase {
public:
// Make sure the ECMASCRIPT_OBJECT_DUMP in config.h has been opened before use it
// Use through ArkTools.print(msg, [obj1, obj2, ... objn]) in js
- static JSTaggedValue ObjectDump(EcmaRuntimeCallInfo *msg);
+ static JSTaggedValue ObjectDump(EcmaRuntimeCallInfo *info);
- static JSTaggedValue CompareHClass(EcmaRuntimeCallInfo *msg);
+ static JSTaggedValue CompareHClass(EcmaRuntimeCallInfo *info);
- static JSTaggedValue DumpHClass(EcmaRuntimeCallInfo *msg);
+ static JSTaggedValue DumpHClass(EcmaRuntimeCallInfo *info);
+
+ // return whether the hclass used for object is created by static ts type
+ static JSTaggedValue IsTSHClass(EcmaRuntimeCallInfo *info);
+
+ static JSTaggedValue GetHClass(EcmaRuntimeCallInfo *info);
};
} // namespace panda::ecmascript::builtins
diff --git a/ecmascript/builtins/builtins_array.cpp b/ecmascript/builtins/builtins_array.cpp
index 1a16af2b19727e2cc2e939b8000e347c499d38ce..3eb903a5437617ee84bbc2b2622ff05117ce2c5f 100644
--- a/ecmascript/builtins/builtins_array.cpp
+++ b/ecmascript/builtins/builtins_array.cpp
@@ -48,7 +48,7 @@ JSTaggedValue BuiltinsArray::ArrayConstructor(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
// 1. Let numberOfArgs be the number of arguments passed to this function call.
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 3. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget.
JSHandle constructor = GetConstructor(argv);
@@ -115,7 +115,7 @@ JSTaggedValue BuiltinsArray::ArrayConstructor(EcmaRuntimeCallInfo *argv)
// d. Assert: defineStatus is true.
// e. Increase k by 1.
JSMutableHandle key(thread, JSTaggedValue::Undefined());
- for (uint32_t k = 0; k < argc; k++) {
+ for (int32_t k = 0; k < argc; k++) {
key.Update(JSTaggedValue(k));
JSHandle itemK = GetCallArg(argv, k);
JSObject::CreateDataProperty(thread, newArrayHandle, key, itemK);
@@ -172,9 +172,9 @@ JSTaggedValue BuiltinsArray::From(EcmaRuntimeCallInfo *argv)
// c. ReturnIfAbrupt(A).
JSTaggedValue newArray;
if (thisHandle->IsConstructor()) {
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, thisHandle, undefined, undefined, 0);
- newArray = JSFunction::Construct(&info);
+ newArray = JSFunction::Construct(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
} else {
newArray = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue();
@@ -219,14 +219,15 @@ JSTaggedValue BuiltinsArray::From(EcmaRuntimeCallInfo *argv)
// 3. Let mappedValue be mappedValue.[[value]].
// viii. Else, let mappedValue be nextValue.
if (mapping) {
- const size_t argsLength = 2; // 2: «nextValue, k»
- EcmaRuntimeCallInfo info =
+ const int32_t argsLength = 2; // 2: «nextValue, k»
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, mapfn, thisArgHandle, undefined, argsLength);
- info.SetCallArg(nextValue.GetTaggedValue(), key.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(nextValue.GetTaggedValue(), key.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
mapValue.Update(callResult);
JSTaggedValue mapResult = JSIterator::IteratorClose(thread, iterator, mapValue).GetTaggedValue();
- RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue(mapResult));
+ RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, mapResult);
} else {
mapValue.Update(nextValue.GetTaggedValue());
}
@@ -236,7 +237,7 @@ JSTaggedValue BuiltinsArray::From(EcmaRuntimeCallInfo *argv)
JSHandle defineStatus(
thread, JSTaggedValue(JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, key, mapValue)));
JSTaggedValue defineResult = JSIterator::IteratorClose(thread, iterator, defineStatus).GetTaggedValue();
- RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue(defineResult));
+ RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, defineResult);
k++;
}
}
@@ -257,10 +258,11 @@ JSTaggedValue BuiltinsArray::From(EcmaRuntimeCallInfo *argv)
// 14. ReturnIfAbrupt(A).
JSTaggedValue newArray;
if (thisHandle->IsConstructor()) {
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, thisHandle, undefined, undefined, 1);
- info.SetCallArg(JSTaggedValue(len));
- newArray = JSFunction::Construct(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(JSTaggedValue(len));
+ newArray = JSFunction::Construct(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
} else {
newArray = JSArray::ArrayCreate(thread, JSTaggedNumber(len)).GetTaggedValue();
@@ -286,11 +288,12 @@ JSTaggedValue BuiltinsArray::From(EcmaRuntimeCallInfo *argv)
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (mapping) {
key.Update(JSTaggedValue(k));
- const size_t argsLength = 2; // 2: «kValue, k»
- EcmaRuntimeCallInfo info =
+ const int32_t argsLength = 2; // 2: «kValue, k»
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, mapfn, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
mapValue.Update(callResult);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@@ -333,7 +336,7 @@ JSTaggedValue BuiltinsArray::Of(EcmaRuntimeCallInfo *argv)
JSHandle lengthKey = globalConst->GetHandledLengthString();
// 1. Let len be the actual number of arguments passed to this function.
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 3. Let C be the this value.
JSHandle thisHandle = GetThis(argv);
@@ -345,10 +348,11 @@ JSTaggedValue BuiltinsArray::Of(EcmaRuntimeCallInfo *argv)
JSHandle newArray;
if (thisHandle->IsConstructor()) {
JSHandle undefined = globalConst->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, thisHandle, undefined, undefined, 1);
- info.SetCallArg(JSTaggedValue(argc));
- JSTaggedValue taggedArray = JSFunction::Construct(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(JSTaggedValue(argc));
+ JSTaggedValue taggedArray = JSFunction::Construct(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
newArray = JSHandle(thread, taggedArray);
} else {
@@ -368,7 +372,7 @@ JSTaggedValue BuiltinsArray::Of(EcmaRuntimeCallInfo *argv)
// d. ReturnIfAbrupt(defineStatus).
// e. Increase k by 1.
JSMutableHandle key(thread, JSTaggedValue::Undefined());
- for (uint32_t k = 0; k < argc; k++) {
+ for (int32_t k = 0; k < argc; k++) {
key.Update(JSTaggedValue(k));
JSHandle kValue = GetCallArg(argv, k);
JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, key, kValue);
@@ -397,7 +401,7 @@ JSTaggedValue BuiltinsArray::Concat(EcmaRuntimeCallInfo *argv)
BUILTINS_API_TRACE(argv->GetThread(), Array, Concat);
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisHandle = GetThis(argv);
@@ -449,7 +453,7 @@ JSTaggedValue BuiltinsArray::Concat(EcmaRuntimeCallInfo *argv)
n++;
}
// 7. Repeat, while items is not empty
- for (uint32_t i = 0; i < argc; i++) {
+ for (int32_t i = 0; i < argc; i++) {
// a. Remove the first element from items and let E be the value of the element
JSHandle addHandle = GetCallArg(argv, i);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@@ -708,12 +712,13 @@ JSTaggedValue BuiltinsArray::Every(EcmaRuntimeCallInfo *argv)
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, k);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(JSTaggedValue(k));
- const size_t argsLength = 3; // 3: «kValue, k, O»
+ const int32_t argsLength = 3; // 3: «kValue, k, O»
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
bool boolResult = callResult.ToBoolean();
if (!boolResult) {
@@ -870,12 +875,13 @@ JSTaggedValue BuiltinsArray::Filter(EcmaRuntimeCallInfo *argv)
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, k);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(JSTaggedValue(k));
- const size_t argsLength = 3; // 3: «kValue, k, O»
+ const int32_t argsLength = 3; // 3: «kValue, k, O»
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
bool boolResult = callResult.ToBoolean();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (boolResult) {
@@ -936,12 +942,13 @@ JSTaggedValue BuiltinsArray::Find(EcmaRuntimeCallInfo *argv)
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, k);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(JSTaggedValue(k));
- const size_t argsLength = 3; // 3: «kValue, k, O»
+ const int32_t argsLength = 3; // 3: «kValue, k, O»
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
bool boolResult = callResult.ToBoolean();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (boolResult) {
@@ -998,12 +1005,13 @@ JSTaggedValue BuiltinsArray::FindIndex(EcmaRuntimeCallInfo *argv)
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, k);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(JSTaggedValue(k));
- const size_t argsLength = 3; // 3: «kValue, k, O»
+ const int32_t argsLength = 3; // 3: «kValue, k, O»
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
bool boolResult = callResult.ToBoolean();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (boolResult) {
@@ -1064,12 +1072,13 @@ JSTaggedValue BuiltinsArray::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, k);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(JSTaggedValue(k));
- const size_t argsLength = 3; // 3: «kValue, k, O»
+ const int32_t argsLength = 3; // 3: «kValue, k, O»
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue funcResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue funcResult = JSFunction::Call(info);
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, funcResult);
}
k++;
@@ -1087,7 +1096,7 @@ JSTaggedValue BuiltinsArray::IndexOf(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisHandle = GetThis(argv);
@@ -1275,7 +1284,7 @@ JSTaggedValue BuiltinsArray::LastIndexOf(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisHandle = GetThis(argv);
@@ -1400,12 +1409,13 @@ JSTaggedValue BuiltinsArray::Map(EcmaRuntimeCallInfo *argv)
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, k);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(JSTaggedValue(k));
- const size_t argsLength = 3; // 3: «kValue, k, O»
+ const int32_t argsLength = 3; // 3: «kValue, k, O»
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue mapResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue mapResult = JSFunction::Call(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
mapResultHandle.Update(mapResult);
JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, k, mapResultHandle);
@@ -1486,7 +1496,7 @@ JSTaggedValue BuiltinsArray::Push(EcmaRuntimeCallInfo *argv)
return JSStableArray::Push(JSHandle::Cast(thisHandle), argv);
}
// 6. Let argCount be the number of elements in items.
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
@@ -1539,7 +1549,7 @@ JSTaggedValue BuiltinsArray::Reduce(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisHandle = GetThis(argv);
JSHandle thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
@@ -1617,13 +1627,14 @@ JSTaggedValue BuiltinsArray::Reduce(EcmaRuntimeCallInfo *argv)
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(JSTaggedValue(k));
JSHandle thisArgHandle = globalConst->GetHandledUndefined();
- const size_t argsLength = 4; // 4: «accumulator, kValue, k, O»
+ const int32_t argsLength = 4; // 4: «accumulator, kValue, k, O»
JSHandle undefined = globalConst->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(accumulator.GetTaggedValue(), kValue.GetTaggedValue(), key.GetTaggedValue(),
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(accumulator.GetTaggedValue(), kValue.GetTaggedValue(), key.GetTaggedValue(),
thisObjVal.GetTaggedValue());
- callResult = JSFunction::Call(&info);
+ callResult = JSFunction::Call(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
accumulator.Update(callResult);
}
@@ -1643,7 +1654,7 @@ JSTaggedValue BuiltinsArray::ReduceRight(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisHandle = GetThis(argv);
@@ -1722,13 +1733,14 @@ JSTaggedValue BuiltinsArray::ReduceRight(EcmaRuntimeCallInfo *argv)
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, key);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle thisArgHandle = globalConst->GetHandledUndefined();
- const size_t argsLength = 4; // 4: «accumulator, kValue, k, O»
+ const int32_t argsLength = 4; // 4: «accumulator, kValue, k, O»
JSHandle undefined = globalConst->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(accumulator.GetTaggedValue(), kValue.GetTaggedValue(), key.GetTaggedValue(),
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(accumulator.GetTaggedValue(), kValue.GetTaggedValue(), key.GetTaggedValue(),
thisObjVal.GetTaggedValue());
- callResult = JSFunction::Call(&info);
+ callResult = JSFunction::Call(info);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
accumulator.Update(callResult);
}
@@ -2096,12 +2108,13 @@ JSTaggedValue BuiltinsArray::Some(EcmaRuntimeCallInfo *argv)
key.Update(JSTaggedValue(k));
JSHandle kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, key);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
- const size_t argsLength = 3; // 3: «kValue, k, O»
+ const int32_t argsLength = 3; // 3: «kValue, k, O»
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
- info.SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Call(info);
bool boolResult = callResult.ToBoolean();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (boolResult) {
@@ -2186,7 +2199,7 @@ JSTaggedValue BuiltinsArray::Splice(EcmaRuntimeCallInfo *argv)
BUILTINS_API_TRACE(argv->GetThread(), Array, Splice);
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisHandle = GetThis(argv);
JSHandle thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
@@ -2366,7 +2379,7 @@ JSTaggedValue BuiltinsArray::Splice(EcmaRuntimeCallInfo *argv)
k = start;
// 23. Repeat, while items is not empty
JSMutableHandle key(thread, JSTaggedValue::Undefined());
- for (uint32_t i = 2; i < argc; i++) {
+ for (int32_t i = 2; i < argc; i++) {
JSHandle itemValue = GetCallArg(argv, i);
key.Update(JSTaggedValue(k));
JSArray::FastSetPropertyByValue(thread, thisObjVal, key, itemValue);
@@ -2454,10 +2467,11 @@ JSTaggedValue BuiltinsArray::ToLocaleString(EcmaRuntimeCallInfo *argv)
if (!nextElement->IsUndefined() && !nextElement->IsNull()) {
JSHandle nextValueHandle = nextElement;
JSHandle key = globalConst->GetHandledToLocaleStringString();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, nextValueHandle, undefined, 2); // 2: two args
- info.SetCallArg(locales.GetTaggedValue(), options.GetTaggedValue());
- JSTaggedValue callResult = JSFunction::Invoke(&info, key);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(locales.GetTaggedValue(), options.GetTaggedValue());
+ JSTaggedValue callResult = JSFunction::Invoke(info, key);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
next = callResult;
}
@@ -2508,12 +2522,13 @@ JSTaggedValue BuiltinsArray::ToString(EcmaRuntimeCallInfo *argv)
callbackFnHandle = JSTaggedValue::GetProperty(thread, objectPrototype, toStringKey).GetValue();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
- const size_t argsLength = argv->GetArgsNumber();
+ const int32_t argsLength = argv->GetArgsNumber();
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisObjVal, undefined, argsLength);
- info.SetCallArg(argsLength, 0, argv, 0);
- return JSFunction::Call(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(argsLength, 0, argv, 0);
+ return JSFunction::Call(info);
}
// 22.1.3.28 Array.prototype.unshift ( ...items )
@@ -2525,7 +2540,7 @@ JSTaggedValue BuiltinsArray::Unshift(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
// 5. Let argCount be the number of actual arguments.
- uint32_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle thisHandle = GetThis(argv);
@@ -2682,7 +2697,7 @@ JSTaggedValue BuiltinsArray::Flat(EcmaRuntimeCallInfo *argv)
JSHandle thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
- array_size_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
JSHandle thisObjVal(thisObjHandle);
// 2. Let sourceLen be ? LengthOfArrayLike(O).
@@ -2769,7 +2784,7 @@ JSTaggedValue BuiltinsArray::Includes(EcmaRuntimeCallInfo *argv)
JSHandle thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
- array_size_t argc = argv->GetArgsNumber();
+ int32_t argc = argv->GetArgsNumber();
JSHandle thisObjVal(thisObjHandle);
JSHandle searchElement = GetCallArg(argv, 0);
diff --git a/ecmascript/builtins/builtins_arraybuffer.cpp b/ecmascript/builtins/builtins_arraybuffer.cpp
index 830b64671df2367e6396ceae4d691726e939c8ef..67718437e625615a1ea32f3675796bce226ff81b 100644
--- a/ecmascript/builtins/builtins_arraybuffer.cpp
+++ b/ecmascript/builtins/builtins_arraybuffer.cpp
@@ -170,10 +170,11 @@ JSTaggedValue BuiltinsArrayBuffer::Slice(EcmaRuntimeCallInfo *argv)
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// 15. Let new be Construct(ctor, «newLen»).
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, constructor, undefined, undefined, 1);
- info.SetCallArg(JSTaggedValue(newLen));
- JSTaggedValue taggedNewArrBuf = JSFunction::Construct(&info);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ info->SetCallArg(JSTaggedValue(newLen));
+ JSTaggedValue taggedNewArrBuf = JSFunction::Construct(info);
JSHandle newArrBuf(thread, taggedNewArrBuf);
// 16. ReturnIfAbrupt(new).
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
diff --git a/ecmascript/builtins/builtins_atomics.cpp b/ecmascript/builtins/builtins_atomics.cpp
index 1db98b8229a221f2300802495acf984a358231b0..c4e63f7f6bff2df3212c54f20e16ba355df13d0f 100644
--- a/ecmascript/builtins/builtins_atomics.cpp
+++ b/ecmascript/builtins/builtins_atomics.cpp
@@ -157,7 +157,7 @@ JSTaggedValue BuiltinsAtomics::Wait(EcmaRuntimeCallInfo *argv)
{
ASSERT(argv);
JSThread *thread = argv->GetThread();
- BUILTINS_API_TRACE(thread, Atomic, Wait);
+ BUILTINS_API_TRACE(thread, Atomics, Wait);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle array = GetCallArg(argv, 0);
@@ -233,7 +233,7 @@ JSTaggedValue BuiltinsAtomics::Notify(EcmaRuntimeCallInfo *argv)
{
ASSERT(argv);
JSThread *thread = argv->GetThread();
- BUILTINS_API_TRACE(thread, Atomic, Notify);
+ BUILTINS_API_TRACE(thread, Atomics, Notify);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle array = GetCallArg(argv, 0);
@@ -308,7 +308,7 @@ JSTaggedValue BuiltinsAtomics::AtomicReadModifyWriteCase(JSThread *thread, JSTag
JSTaggedValue data = jsArrayBuffer->GetArrayBufferData();
void *pointer = JSNativePointer::Cast(data.GetTaggedObject())->GetExternalPointer();
auto *block = reinterpret_cast(pointer);
- uint32_t size = argv->GetArgsNumber();
+ uint32_t size = static_cast(argv->GetArgsNumber());
switch (type) {
case DataViewType::UINT8:
return HandleWithUint8(thread, size, block, indexedPosition, argv, op);
diff --git a/ecmascript/builtins/builtin_cjs_exports.cpp b/ecmascript/builtins/builtins_cjs_exports.cpp
similarity index 95%
rename from ecmascript/builtins/builtin_cjs_exports.cpp
rename to ecmascript/builtins/builtins_cjs_exports.cpp
index 4525c509859270204d394093298b4d4a98bc8240..eb9edd0773cc81aa67fcc68c331605d329bd4244 100644
--- a/ecmascript/builtins/builtin_cjs_exports.cpp
+++ b/ecmascript/builtins/builtins_cjs_exports.cpp
@@ -15,10 +15,9 @@
#include "ecmascript/base/builtins_base.h"
#include "ecmascript/require/js_cjs_exports.h"
-#include "ecmascript/builtins/builtin_cjs_exports.h"
+#include "ecmascript/builtins/builtins_cjs_exports.h"
namespace panda::ecmascript::builtins {
-
JSTaggedValue BuiltinsCjsExports::CjsExportsConstructor(EcmaRuntimeCallInfo *argv)
{
JSThread *thread = argv->GetThread();
diff --git a/ecmascript/builtins/builtin_cjs_exports.h b/ecmascript/builtins/builtins_cjs_exports.h
similarity index 99%
rename from ecmascript/builtins/builtin_cjs_exports.h
rename to ecmascript/builtins/builtins_cjs_exports.h
index cf37359bc20169ee4a4f0afddc1aabad00bf175b..b22a7cc1c52cf9b8d5fe3b9d8a625802247de070 100644
--- a/ecmascript/builtins/builtin_cjs_exports.h
+++ b/ecmascript/builtins/builtins_cjs_exports.h
@@ -23,9 +23,7 @@
namespace panda::ecmascript::builtins {
class BuiltinsCjsExports : public base::BuiltinsBase {
public:
-
static JSTaggedValue CjsExportsConstructor(EcmaRuntimeCallInfo *argv);
-
};
} // namespace panda::ecmascript::builtins
#endif // ECMASCRIPT_BUILTINS_BUILTINS_CJS_EXPORTS_H
diff --git a/ecmascript/builtins/builtin_cjs_module.cpp b/ecmascript/builtins/builtins_cjs_module.cpp
similarity index 89%
rename from ecmascript/builtins/builtin_cjs_module.cpp
rename to ecmascript/builtins/builtins_cjs_module.cpp
index 3599d3b45f4fd67911fe1d83395bd49cb1ec30bc..0258887e375538721c9fa62a0c6c05a04641e23b 100644
--- a/ecmascript/builtins/builtin_cjs_module.cpp
+++ b/ecmascript/builtins/builtins_cjs_module.cpp
@@ -14,7 +14,7 @@
*/
#include "ecmascript/base/builtins_base.h"
-#include "ecmascript/builtins/builtin_cjs_module.h"
+#include "ecmascript/builtins/builtins_cjs_module.h"
#include "ecmascript/require/js_cjs_module.h"
#include "ecmascript/require/js_require_manager.h"
#include "ecmascript/interpreter/interpreter-inl.h"
@@ -51,19 +51,19 @@ JSTaggedValue BuiltinsCjsModule::ResolveFilename(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
- uint32_t length = argv->GetArgsNumber();
+ int32_t length = argv->GetArgsNumber();
JSMutableHandle parent(thread, JSTaggedValue::Undefined());
JSMutableHandle dirname(thread, JSTaggedValue::Undefined());
const JSPandaFile *jsPandaFile = EcmaInterpreter::GetNativeCallPandafile(thread);
- JSRequireManager::ResolveCurrentPath(thread, parent, dirname, jsPandaFile);
+ RequireManager::ResolveCurrentPath(thread, parent, dirname, jsPandaFile);
if (length != 1) { // strange arg's number
LOG_ECMA(ERROR) << "BuiltinsCjsModule::Load : can only accept one argument";
UNREACHABLE();
}
JSHandle requestName = JSHandle::Cast(GetCallArg(argv, 0));
- JSHandle filename = JSCjsModule::ResolveFilename(thread, dirname.GetTaggedValue(),
- requestName.GetTaggedValue());
+ JSHandle filename = CjsModule::ResolveFilename(thread, dirname.GetTaggedValue(),
+ requestName.GetTaggedValue());
return filename.GetTaggedValue();
}
diff --git a/ecmascript/builtins/builtin_cjs_module.h b/ecmascript/builtins/builtins_cjs_module.h
similarity index 100%
rename from ecmascript/builtins/builtin_cjs_module.h
rename to ecmascript/builtins/builtins_cjs_module.h
diff --git a/ecmascript/builtins/builtin_cjs_require.cpp b/ecmascript/builtins/builtins_cjs_require.cpp
similarity index 93%
rename from ecmascript/builtins/builtin_cjs_require.cpp
rename to ecmascript/builtins/builtins_cjs_require.cpp
index 16aaebb576226d61eab02dce33c0a3758f0ea633..3fe8d6accf6b15133f0ac89d48ecdd032927ad40 100644
--- a/ecmascript/builtins/builtin_cjs_require.cpp
+++ b/ecmascript/builtins/builtins_cjs_require.cpp
@@ -19,10 +19,9 @@
#include "ecmascript/js_object-inl.h"
#include "ecmascript/js_tagged_value-inl.h"
#include "ecmascript/js_thread.h"
-#include "ecmascript/builtins/builtin_cjs_require.h"
+#include "ecmascript/builtins/builtins_cjs_require.h"
namespace panda::ecmascript::builtins {
-
JSTaggedValue BuiltinsCjsRequire::CjsRequireConstructor(EcmaRuntimeCallInfo *argv)
{
JSThread *thread = argv->GetThread();
@@ -33,14 +32,14 @@ JSTaggedValue BuiltinsCjsRequire::CjsRequireConstructor(EcmaRuntimeCallInfo *arg
if (!newTarget->IsUndefined()) {
THROW_TYPE_ERROR_AND_RETURN(thread, "newTarget is undefined", JSTaggedValue::Exception());
}
- uint32_t length = argv->GetArgsNumber();
+ int32_t length = argv->GetArgsNumber();
JSHandle result(thread, JSTaggedValue::Undefined());
if (length != 1) { // strange arg's number
LOG_ECMA(ERROR) << "BuiltinsCjsRequire::CjsRequireConstructor : can only accept one argument";
UNREACHABLE();
}
JSHandle requestName = JSHandle::Cast(GetCallArg(argv, 0));
- result = JSCjsModule::Load(thread, requestName);
+ result = CjsModule::Load(thread, requestName);
return result.GetTaggedValue();
}
diff --git a/ecmascript/builtins/builtin_cjs_require.h b/ecmascript/builtins/builtins_cjs_require.h
similarity index 100%
rename from ecmascript/builtins/builtin_cjs_require.h
rename to ecmascript/builtins/builtins_cjs_require.h
diff --git a/ecmascript/builtins/builtins_date.cpp b/ecmascript/builtins/builtins_date.cpp
index 1721d8e82772d0c2ff04cbf163e16a229593218e..75a1c784af28116889d915493434b9d9adad26f7 100644
--- a/ecmascript/builtins/builtins_date.cpp
+++ b/ecmascript/builtins/builtins_date.cpp
@@ -41,7 +41,7 @@ JSTaggedValue BuiltinsDate::DateConstructor(EcmaRuntimeCallInfo *argv)
}
JSTaggedValue timeValue(0.0);
- uint32_t length = argv->GetArgsNumber();
+ uint32_t length = static_cast(argv->GetArgsNumber());
if (length == 0) { // no value
timeValue = JSDate::Now();
} else if (length == 1) { // one value
@@ -177,9 +177,9 @@ JSTaggedValue BuiltinsDate::ToJSON(EcmaRuntimeCallInfo *argv)
}
JSHandle calleeKey(thread->GetEcmaVM()->GetFactory()->NewFromASCII("toISOString"));
JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined();
- EcmaRuntimeCallInfo info =
+ EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, objectHandle, undefined, 0);
- return JSFunction::Invoke(&info, calleeKey);
+ return JSFunction::Invoke(info, calleeKey);
}
// 20.4.4.44
diff --git a/ecmascript/builtins/builtins_errors.cpp b/ecmascript/builtins/builtins_errors.cpp
index 9be6f76d93e23c66eff03d261a5951b32496e2be..b54752f724f999eb810452dd43244dddd422b4cd 100644
--- a/ecmascript/builtins/builtins_errors.cpp
+++ b/ecmascript/builtins/builtins_errors.cpp
@@ -15,7 +15,12 @@
#include "ecmascript/builtins/builtins_errors.h"
#include "ecmascript/base/error_helper.h"
+#include "ecmascript/ecma_macros.h"
+#include "ecmascript/global_env.h"
#include "ecmascript/js_tagged_value-inl.h"
+#include "ecmascript/js_array.h"
+#include "ecmascript/js_primitive_ref.h"
+#include "ecmascript/js_iterator.h"
namespace panda::ecmascript::builtins {
using ErrorHelper = base::ErrorHelper;
@@ -103,4 +108,55 @@ JSTaggedValue BuiltinsEvalError::ToString(EcmaRuntimeCallInfo *argv)
{
return ErrorHelper::ErrorCommonToString(argv, ErrorType::EVAL_ERROR);
}
+
+// AggregateError
+JSTaggedValue BuiltinsAggregateError::AggregateErrorConstructor(EcmaRuntimeCallInfo *argv)
+{
+ JSThread *thread = argv->GetThread();
+ [[maybe_unused]] EcmaHandleScope scope(thread);
+ EcmaVM *ecmaVm = thread->GetEcmaVM();
+ ObjectFactory *factory = ecmaVm->GetFactory();
+ const GlobalEnvConstants *globalConst = thread->GlobalConstants();
+ // 1. If NewTarget is undefined, let newTarget be the active function object; else let newTarget be NewTarget.
+ JSHandle constructor = GetConstructor(argv);
+ JSMutableHandle newTarget(thread, GetNewTarget(argv));
+ if (newTarget->IsUndefined()) {
+ newTarget.Update(constructor.GetTaggedValue());
+ }
+ JSHandle errors = BuiltinsBase::GetCallArg(argv, 0);
+ JSHandle message = BuiltinsBase::GetCallArg(argv, 1);
+ // 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%AggregateError.prototype%", « [[ErrorData]] »).
+ JSHandle objValues = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ JSHandle taggedObj = JSHandle::Cast(objValues);
+ // 3. If message is not undefined, then
+ // a. Let msg be ? ToString(message).
+ // b. Let msgDesc be the PropertyDescriptor
+ // { [[Value]]: msg, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }.
+ // c. Perform ! DefinePropertyOrThrow(O, "message", msgDesc).
+ JSHandle msgKey = globalConst->GetHandledMessageString();
+ JSHandle errorsKey = globalConst->GetHandledErrorsString();
+ if (!message->IsUndefined()) {
+ JSHandle handleStr = JSTaggedValue::ToString(thread, message);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ PropertyDescriptor msgDesc(thread, JSHandle::Cast(handleStr), true, false, true);
+ JSTaggedValue::DefinePropertyOrThrow(thread, taggedObj, msgKey, msgDesc);
+ }
+ // 4. Let errorsList be ? IterableToList(errors).
+ JSHandle errorsList = JSObject::IterableToList(thread, errors);
+ RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
+ // 5. Perform ! DefinePropertyOrThrow(O, "errors", PropertyDescriptor { [[Configurable]]: true,
+ // [[Enumerable]]: false, [[Writable]]: true, [[Value]]: !CreateArrayFromList(errorsList) }).
+ JSHandle errorsArray = JSArray::ToTaggedArray(thread, errorsList);
+ JSHandle errorsValues(JSArray::CreateArrayFromList(thread, errorsArray));
+ PropertyDescriptor msgDesc(thread, errorsValues, true, false, true);
+ JSTaggedValue::DefinePropertyOrThrow(thread, taggedObj, errorsKey, msgDesc);
+ // 6. Return O.
+ return taggedObj.GetTaggedValue();
+}
+
+JSTaggedValue BuiltinsAggregateError::ToString(EcmaRuntimeCallInfo *argv)
+{
+ return ErrorHelper::ErrorCommonToString(argv, ErrorType::AGGREGATE_ERROR);
+}
} // namespace panda::ecmascript::builtins
diff --git a/ecmascript/builtins/builtins_errors.h b/ecmascript/builtins/builtins_errors.h
index 9c842a790a927f0d096364c4048bb1b946e40203..7f9e83f841e09f723ae75244c608ed98035edf30 100644
--- a/ecmascript/builtins/builtins_errors.h
+++ b/ecmascript/builtins/builtins_errors.h
@@ -77,6 +77,13 @@ public:
static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv);
};
-} // namespace panda::ecmascript::builtins
+
+class BuiltinsAggregateError : public base::BuiltinsBase {
+public:
+ static JSTaggedValue AggregateErrorConstructor(EcmaRuntimeCallInfo *argv);
+
+ static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv);
+};
+} // namespace panda::ecmascript::builtins
#endif // ECMASCRIPT_BUILTINS_BUILTINS_ERRORS_H
diff --git a/ecmascript/builtins/builtins_finalization_registry.cpp b/ecmascript/builtins/builtins_finalization_registry.cpp
index 25bfb1355b5ab95ed3accafc233fde2522469f1a..34e48d7a69dfbadd8f33e8d96fdfcf6dd397580f 100644
--- a/ecmascript/builtins/builtins_finalization_registry.cpp
+++ b/ecmascript/builtins/builtins_finalization_registry.cpp
@@ -63,7 +63,7 @@ JSTaggedValue BuiltinsFinalizationRegistry::Register(EcmaRuntimeCallInfo *argv)
{
ASSERT(argv);
JSThread *thread = argv->GetThread();
- BUILTINS_API_TRACE(thread, BuiltinsFinalizationRegistry, Register);
+ BUILTINS_API_TRACE(thread, FinalizationRegistry, Register);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle target = GetCallArg(argv, 0);
JSHandle heldValue = GetCallArg(argv, 1);
@@ -102,7 +102,7 @@ JSTaggedValue BuiltinsFinalizationRegistry::Unregister(EcmaRuntimeCallInfo *argv
{
ASSERT(argv);
JSThread *thread = argv->GetThread();
- BUILTINS_API_TRACE(thread, BuiltinsFinalizationRegistry, Unregister);
+ BUILTINS_API_TRACE(thread, FinalizationRegistry, Unregister);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle unregisterToken = GetCallArg(argv, 0);
// 1. Let finalizationRegistry be the this value.
diff --git a/ecmascript/builtins/builtins_function.cpp b/ecmascript/builtins/builtins_function.cpp
index 031244f66709f01572992e39b93fd70a1e7945fd..beb862c1dfc19a648ef6987637dc97d4889ec140 100644
--- a/ecmascript/builtins/builtins_function.cpp
+++ b/ecmascript/builtins/builtins_function.cpp
@@ -104,8 +104,8 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeApply(EcmaRuntimeCallInfo *argv
// 2. If argArray is null or undefined, then
if (GetCallArg(argv, 1)->IsUndefined()) { // null will also get undefined
// a. Return Call(func, thisArg).
- EcmaRuntimeCallInfo info = EcmaInterpreter::NewRuntimeCallInfo(thread, func, thisArg, undefined, 0);
- return JSFunction::Call(&info);
+ EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, func, thisArg, undefined, 0);
+ return JSFunction::Call(info);
}
// 3. Let argList be CreateListFromArrayLike(argArray).
JSHandle