arkcompiler_ets_runtime/BUILD.gn
openharmony_ci c596fe9867
!5050 PGO AssertType
Merge pull request !5050 from 刘智杰/assert_type
2023-10-28 14:26:14 +00:00

1230 lines
38 KiB
Plaintext

# 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
import("//arkcompiler/ets_runtime/js_runtime_config.gni")
import("$build_root/config/sanitizers/sanitizers.gni")
import("$build_root/toolchain/toolchain.gni")
group("ark_js_packages") {
deps = []
if (host_os != "mac") {
deps += [
":libark_jsruntime",
"ecmascript/compiler:stub.an",
"ecmascript/js_vm:ark_js_context",
"ecmascript/js_vm:ark_js_vm",
"ecmascript/quick_fix:quick_fix",
]
if (is_clang && clang_version != "9.0.3" && current_cpu == "arm64" &&
is_ohos) {
deps += [
"ecmascript/compiler:ark_aot_compiler",
"ecmascript/pgo_profiler/prof_dump:profdump",
]
}
}
}
group("ark_js_host_windows_tools_packages") {
deps = []
if (host_os != "mac" && target_os != "android") {
deps += [
"ecmascript/compiler:ark_aot_compiler($build_root/toolchain/mingw:mingw_x86_64)",
"ecmascript/js_vm:ark_js_context($build_root/toolchain/mingw:mingw_x86_64)",
"ecmascript/js_vm:ark_js_vm($build_root/toolchain/mingw:mingw_x86_64)",
"ecmascript/pgo_profiler/prof_dump:profdump($build_root/toolchain/mingw:mingw_x86_64)",
]
}
}
group("ark_js_host_mac_tools_packages") {
deps = []
if (host_os == "mac") {
if (host_cpu == "arm64") {
deps += [
"ecmascript/compiler:ark_aot_compiler($build_root/toolchain/mac:clang_arm64)",
"ecmascript/js_vm:ark_js_context($build_root/toolchain/mac:clang_arm64)",
"ecmascript/js_vm:ark_js_vm($build_root/toolchain/mac:clang_arm64)",
"ecmascript/pgo_profiler/prof_dump:profdump($build_root/toolchain/mac:clang_arm64)",
]
} else {
deps += [
"ecmascript/compiler:ark_aot_compiler($build_root/toolchain/mac:clang_x64)",
"ecmascript/js_vm:ark_js_context($build_root/toolchain/mac:clang_x64)",
"ecmascript/js_vm:ark_js_vm($build_root/toolchain/mac:clang_x64)",
"ecmascript/pgo_profiler/prof_dump:profdump($build_root/toolchain/mac:clang_x64)",
]
}
}
}
group("ark_js_host_linux_tools_packages") {
deps = []
if (host_os != "mac") {
deps += [
"ecmascript/js_vm:ark_js_context(${host_toolchain})",
"ecmascript/js_vm:ark_js_vm(${host_toolchain})",
"ecmascript/quick_fix:quick_fix(${host_toolchain})",
]
if (is_standard_system) {
deps += [
"ecmascript/pgo_profiler/prof_dump:profdump(${host_toolchain})",
"//arkcompiler/ets_runtime/ecmascript/compiler:ark_aot_compiler(${host_toolchain})",
"//arkcompiler/ets_runtime/ecmascript/compiler:ark_stub_compiler(${host_toolchain})",
]
}
}
}
group("ark_js_unittest") {
testonly = true
deps = []
if (host_os != "mac") {
deps += [
"ecmascript/pgo_profiler/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/base/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/builtins/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/containers/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/debugger/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/dfx/hprof/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/ic/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/jobs/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/jspandafile/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/module/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/napi/test:unittest",
"//arkcompiler/ets_runtime/ecmascript/regexp/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/require/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/snapshot/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/tests:unittest",
"//arkcompiler/ets_runtime/ecmascript/ts_types/tests:unittest",
]
if (is_ohos && is_standard_system) {
deps += [ "//arkcompiler/ets_runtime/test/fuzztest:fuzztest" ]
}
}
}
group("ark_js_perform") {
testonly = true
deps = []
deps += [ "//arkcompiler/ets_runtime/test/perform:perform" ]
}
group("ark_unittest") {
testonly = true
deps = []
if (host_os != "mac") {
# js unittest
deps += [
"ecmascript/base/tests:host_unittest",
"ecmascript/builtins/tests:host_unittest",
"ecmascript/containers/tests:host_unittest",
"ecmascript/dfx/hprof/tests:host_unittest",
"ecmascript/ic/tests:host_unittest",
"ecmascript/jobs/tests:host_unittest",
"ecmascript/jspandafile/tests:host_unittest",
"ecmascript/module/tests:host_unittest",
"ecmascript/napi/test:host_unittest",
"ecmascript/pgo_profiler/tests:host_unittest",
"ecmascript/regexp/tests:host_unittest",
"ecmascript/require/tests:host_unittest",
"ecmascript/snapshot/tests:host_unittest",
"ecmascript/tests:host_unittest",
"ecmascript/ts_types/tests:host_unittest",
]
if (!run_with_asan) {
if (!(ark_standalone_build && current_os == "ohos")) {
deps += [ "ecmascript/compiler/tests:host_unittest" ]
}
}
}
}
if (!run_with_asan) {
_builtins_dts_path_ =
rebase_path("./ecmascript/ts_types/lib_ark_builtins.d.ts")
_es2abc_builtins_d_abc_path_ =
"$target_out_dir/lib_ark_builtins/es2abc/lib_ark_builtins.d.abc"
es2abc_gen_abc("es2abc_gen_builtins_d_abc") {
extra_visibility = [ "*" ]
# extra_dependencies = _deps_
src_js = rebase_path(_builtins_dts_path_)
dst_file = rebase_path(_es2abc_builtins_d_abc_path_)
extension = "ts"
extra_args = [
"--module",
"--merge-abc",
"--type-extractor",
"--type-dts-builtin",
]
in_puts = [ _builtins_dts_path_ ]
out_puts = [ _es2abc_builtins_d_abc_path_ ]
}
}
group("ark_runtime_host_unittest") {
testonly = true
deps = []
if (host_os != "mac") {
# js unittest
deps += [
":ark_unittest",
"$js_root/test/typeinfer:ark_pgotypeinfer_test",
]
# js bytecode test
deps += [ "$js_root/test/moduletest:ark_js_moduletest" ]
# quickfix test
deps += [ "$js_root/test/quickfix:ark_quickfix_test" ]
if (!ark_standalone_build && run_regress_test) {
deps += [ "$js_root/test/regresstest:ark_regress_test" ]
}
# ts aot test and asm test
if (!run_with_asan) {
deps += [
"$js_root/test/aottest:ark_aot_test",
#"$js_root/test/moduletest:ark_asm_single_step_test",
"$js_root/test/deopttest:ark_deopt_test",
"$js_root/test/moduletest:ark_asm_test",
"$js_root/test/typeinfer:ark_typeinfer_test",
]
}
}
}
config("ark_jsruntime_public_config") {
configs = [
"$ark_root/libpandabase:arkbase_public_config",
"$ark_root/libpandafile:arkfile_public_config",
"$ark_third_party_root/icu/icu4c:icu_config",
sdk_libc_secshared_config,
]
include_dirs = [
"$js_root",
"$js_root/ecmascript/napi/include",
]
}
intl_sources = []
if (enable_ark_intl) {
intl_sources += [
"ecmascript/builtins/builtins_collator.cpp",
"ecmascript/builtins/builtins_date_time_format.cpp",
"ecmascript/builtins/builtins_displaynames.cpp",
"ecmascript/builtins/builtins_intl.cpp",
"ecmascript/builtins/builtins_list_format.cpp",
"ecmascript/builtins/builtins_locale.cpp",
"ecmascript/builtins/builtins_number_format.cpp",
"ecmascript/builtins/builtins_plural_rules.cpp",
"ecmascript/builtins/builtins_relative_time_format.cpp",
"ecmascript/js_collator.cpp",
"ecmascript/js_date_time_format.cpp",
"ecmascript/js_displaynames.cpp",
"ecmascript/js_list_format.cpp",
"ecmascript/js_locale.cpp",
"ecmascript/js_number_format.cpp",
"ecmascript/js_plural_rules.cpp",
"ecmascript/js_relative_time_format.cpp",
]
} else {
if (target_os != "android" && target_os != "ios") {
intl_sources += [ "ecmascript/intl/global_intl_helper.cpp" ]
}
}
config("ark_jsruntime_compiler_config") {
configs = [ "$js_root:ark_jsruntime_common_config" ]
}
config("hiviewdfx_config") {
defines = []
if (enable_dump_in_faultlog) {
defines += [ "ENABLE_DUMP_IN_FAULTLOG" ]
}
if (enable_bytrace) {
defines += [ "ENABLE_BYTRACE" ]
cflags_cc = [ "-Wno-gnu-zero-variadic-macro-arguments" ]
}
if (enable_hitrace) {
defines += [ "ENABLE_HITRACE" ]
}
if (enable_hilog) {
defines += [ "ENABLE_HILOG" ]
}
include_dirs = [ "$hilog_root/include" ]
}
config("ark_jsruntime_common_config") {
configs = [ ":hiviewdfx_config" ]
defines = [ "PANDA_ENABLE_LTO" ]
cflags_cc = [
"-Wall",
"-Wshadow",
"-Werror",
"-Wextra",
"-pedantic",
"-Wno-invalid-offsetof",
"-Wno-gnu-statement-expression",
"-pipe",
"-Wdate-time",
"-funwind-tables",
"-fno-rtti",
"-fasynchronous-unwind-tables",
"-Wformat=2",
"-std=c++17",
"-Wno-unused-but-set-variable",
]
if (use_musl) {
defines += [ "PANDA_USE_MUSL" ]
}
if (build_public_version) {
defines += [ "IS_PUBLIC_VERSION" ]
}
if (ark_compile_mode != "release") {
ark_profiler_features = [
"ECMASCRIPT_SUPPORT_CPUPROFILER",
"ECMASCRIPT_SUPPORT_HEAPPROFILER",
"ECMASCRIPT_SUPPORT_HEAPSAMPLING",
"ECMASCRIPT_SUPPORT_SNAPSHOT",
]
defines += [ "ECMASCRIPT_SUPPORT_DEBUGGER" ]
defines += ark_profiler_features
}
ldflags = []
if (is_linux) {
defines += [
"PANDA_TARGET_UNIX",
"PANDA_TARGET_LINUX",
"PANDA_USE_FUTEX",
]
} else if (is_mingw) {
cflags_cc += [
"-std=c++17",
"-Wno-ignored-attributes",
]
defines += [
"PANDA_TARGET_WINDOWS",
"_CRTBLD",
"__LIBMSVCRT__",
]
ldflags += [ "-lshlwapi" ]
# not support profiler on Windows yet
if (ark_compile_mode != "release") {
defines -= ark_profiler_features
}
} else if (is_mac) {
defines += [
"PANDA_TARGET_UNIX",
"PANDA_TARGET_MACOS",
]
# not support profiler on MacOS yet
if (ark_compile_mode != "release") {
defines -= ark_profiler_features
}
} else if (target_os == "android") {
defines += [
"PANDA_TARGET_ANDROID",
"PANDA_TARGET_UNIX",
"PANDA_USE_FUTEX",
]
if (current_cpu == "arm64") {
defines += [ "EXCLUDE_C_INTERPRETER" ]
}
if (!ark_standalone_build) {
defines += [ "ENABLE_ANLOG" ]
}
} else if (target_os == "ios") {
defines += [
"PANDA_TARGET_IOS",
"PANDA_TARGET_UNIX",
]
# not support profiler on iOS yet
if (ark_compile_mode != "release") {
defines -= ark_profiler_features
}
} else {
defines += [
"PANDA_TARGET_UNIX",
"PANDA_USE_FUTEX",
]
if (!is_standard_system && (current_cpu != "arm" || is_wearable_product)) {
defines += [ "PANDA_TARGET_MOBILE" ]
}
}
if (!is_mac && target_os != "ios" && !use_libfuzzer && !enable_lto_O0) {
cflags_cc += [ "-flto=thin" ]
ldflags += [ "-flto=thin" ]
}
if (is_debug) {
cflags_cc += [
"-O0",
"-ggdb3",
]
} else {
defines += [ "NDEBUG" ]
}
if (enable_asm_assert) {
defines += [ "ENABLE_ASM_ASSERT" ]
}
if (run_with_asan) {
defines += [ "RUN_WITH_ASAN" ]
}
if (enable_cow_array) {
defines += [ "ENABLE_COW_ARRAY" ]
}
if (run_with_asan && is_linux &&
(current_cpu == "x86" || current_cpu == "x64")) {
cflags_cc += [
"-fno-inline-functions",
"-fno-inline",
"-fsanitize=address",
"-fsanitize-address-use-after-scope",
"-fno-omit-frame-pointer",
"-fsanitize=leak",
]
if (!use_musl) {
libs = [ "$clang_base_path/lib64/clang/$clang_version/lib/linux/libclang_rt.asan-x86_64.a" ]
} else {
libs = [ "$clang_base_path/lib/clang/$clang_version/lib/x86_64-linux-ohos/libclang_rt.asan.a" ]
}
}
if (current_cpu == "arm") {
defines += [
"PANDA_TARGET_ARM32_ABI_SOFT=1",
"PANDA_TARGET_ARM32",
"PANDA_TARGET_32",
]
} else if (current_cpu == "arm64") {
defines += [
"PANDA_TARGET_ARM64",
"PANDA_TARGET_64",
"PANDA_ENABLE_GLOBAL_REGISTER_VARIABLES",
"PANDA_USE_32_BIT_POINTER",
]
} else if (current_cpu == "x86") {
defines += [ "PANDA_TARGET_X86" ]
} else if (current_cpu == "amd64" || current_cpu == "x64" ||
current_cpu == "x86_64") {
defines += [
"PANDA_TARGET_64",
"PANDA_TARGET_AMD64",
"PANDA_USE_32_BIT_POINTER",
]
}
if (enable_ark_intl) {
defines += [ "ARK_SUPPORT_INTL" ]
} else {
if (target_os == "android" || target_os == "ios") {
defines += [ "ARK_NOT_SUPPORT_INTL_GLOBAL" ]
} else {
configs += [ "$global_root/frameworks/intl:intl_util_config" ]
}
}
if (enable_leak_check || is_asan) {
defines += [ "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK" ]
}
if (is_ohos && is_standard_system) {
defines += [ "ENABLE_EXCEPTION_BACKTRACE" ]
if (use_musl && (current_cpu == "arm" || current_cpu == "arm64") &&
!is_mac && !is_mingw && target_os != "ios" && !is_asan) {
defines += [ "HOOK_ENABLE" ]
}
}
# is_asan: skynet config; run_with_asan: est_runtime enable asan config
if (is_asan) {
defines += [ "ECMASCRIPT_ENABLE_DFX_CONFIG" ]
}
}
# ecmascript unit testcase config
config("ecma_test_config") {
visibility = [
"./ecmascript/*",
"./test/fuzztest/*",
]
configs = [
"$js_root:ark_jsruntime_public_config",
"$js_root:ark_jsruntime_common_config",
]
if (enable_leak_check || is_asan) {
defines = [ "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK" ]
}
ldflags = [ "-Wl,-rpath=\$ORIGIN/" ]
if (!ark_standalone_build) {
ldflags += [ "-Wl,--lto-O0" ]
}
}
# ecmascript icu path for testcase config
config("icu_path_test_config") {
icu_data_path = rebase_path("//third_party/icu/ohos_icu4j/data")
defines = [ "ICU_PATH=\"${icu_data_path}\"" ]
}
# asm interpreter enable config
config("asm_interp_enable_config") {
if ((current_cpu == "amd64" || current_cpu == "x64" ||
current_cpu == "x86_64" || current_cpu == "arm64") && !is_mingw &&
!is_mac && target_os != "ios" && !is_emulator) {
defines = [ "SUPPORT_ENABLE_ASM_INTERP" ]
}
}
ecma_source = [
"ecmascript/base/array_helper.cpp",
"ecmascript/base/atomic_helper.cpp",
"ecmascript/base/builtins_base.cpp",
"ecmascript/base/error_helper.cpp",
"ecmascript/base/fast_json_stringifier.cpp",
"ecmascript/base/json_helper.cpp",
"ecmascript/base/json_parser.cpp",
"ecmascript/base/json_stringifier.cpp",
"ecmascript/base/number_helper.cpp",
"ecmascript/base/path_helper.cpp",
"ecmascript/base/string_helper.cpp",
"ecmascript/base/typed_array_helper.cpp",
"ecmascript/base/utf_helper.cpp",
"ecmascript/builtins/builtins.cpp",
"ecmascript/builtins/builtins_ark_tools.cpp",
"ecmascript/builtins/builtins_array.cpp",
"ecmascript/builtins/builtins_arraybuffer.cpp",
"ecmascript/builtins/builtins_async_from_sync_iterator.cpp",
"ecmascript/builtins/builtins_async_function.cpp",
"ecmascript/builtins/builtins_async_generator.cpp",
"ecmascript/builtins/builtins_atomics.cpp",
"ecmascript/builtins/builtins_bigint.cpp",
"ecmascript/builtins/builtins_boolean.cpp",
"ecmascript/builtins/builtins_dataview.cpp",
"ecmascript/builtins/builtins_date.cpp",
"ecmascript/builtins/builtins_errors.cpp",
"ecmascript/builtins/builtins_finalization_registry.cpp",
"ecmascript/builtins/builtins_function.cpp",
"ecmascript/builtins/builtins_generator.cpp",
"ecmascript/builtins/builtins_global.cpp",
"ecmascript/builtins/builtins_iterator.cpp",
"ecmascript/builtins/builtins_async_iterator.cpp",
"ecmascript/builtins/builtins_json.cpp",
"ecmascript/builtins/builtins_lazy_callback.cpp",
"ecmascript/builtins/builtins_map.cpp",
"ecmascript/builtins/builtins_math.cpp",
"ecmascript/builtins/builtins_number.cpp",
"ecmascript/builtins/builtins_object.cpp",
"ecmascript/builtins/builtins_promise.cpp",
"ecmascript/builtins/builtins_promise_handler.cpp",
"ecmascript/builtins/builtins_promise_job.cpp",
"ecmascript/builtins/builtins_proxy.cpp",
"ecmascript/builtins/builtins_reflect.cpp",
"ecmascript/builtins/builtins_regexp.cpp",
"ecmascript/builtins/builtins_set.cpp",
"ecmascript/builtins/builtins_sharedarraybuffer.cpp",
"ecmascript/builtins/builtins_string.cpp",
"ecmascript/builtins/builtins_string_iterator.cpp",
"ecmascript/builtins/builtins_symbol.cpp",
"ecmascript/builtins/builtins_typedarray.cpp",
"ecmascript/builtins/builtins_weak_map.cpp",
"ecmascript/builtins/builtins_weak_ref.cpp",
"ecmascript/builtins/builtins_weak_set.cpp",
"ecmascript/byte_array.cpp",
"ecmascript/compiler/aot_file/elf_builder.cpp",
"ecmascript/compiler/aot_file/elf_reader.cpp",
"ecmascript/compiler/aot_file/an_file_data_manager.cpp",
"ecmascript/compiler/aot_file/an_file_info.cpp",
"ecmascript/compiler/aot_file/aot_file_info.cpp",
"ecmascript/compiler/aot_file/stub_file_info.cpp",
"ecmascript/compiler/aot_file/binary_buffer_parser.cpp",
"ecmascript/compiler/aot_file/module_section_des.cpp",
"ecmascript/compiler/aot_file/aot_file_manager.cpp",
"ecmascript/compiler/pgo_bc_info.cpp",
"ecmascript/containers/containers_arraylist.cpp",
"ecmascript/containers/containers_deque.cpp",
"ecmascript/containers/containers_errors.cpp",
"ecmascript/containers/containers_hashmap.cpp",
"ecmascript/containers/containers_hashset.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",
"ecmascript/containers/containers_private.cpp",
"ecmascript/containers/containers_queue.cpp",
"ecmascript/containers/containers_stack.cpp",
"ecmascript/containers/containers_treemap.cpp",
"ecmascript/containers/containers_treeset.cpp",
"ecmascript/containers/containers_vector.cpp",
"ecmascript/date_parse.cpp",
"ecmascript/deoptimizer/calleeReg.cpp",
"ecmascript/deoptimizer/deoptimizer.cpp",
"ecmascript/dfx/stackinfo/js_stackinfo.cpp",
"ecmascript/dfx/vmstat/caller_stat.cpp",
"ecmascript/dfx/vmstat/function_call_timer.cpp",
"ecmascript/dfx/vmstat/opt_code_profiler.cpp",
"ecmascript/dfx/vmstat/runtime_stat.cpp",
"ecmascript/dfx/vm_thread_control.cpp",
"ecmascript/dump.cpp",
"ecmascript/ecma_context.cpp",
"ecmascript/ecma_handle_scope.cpp",
"ecmascript/ecma_string.cpp",
"ecmascript/ecma_string_table.cpp",
"ecmascript/ecma_vm.cpp",
"ecmascript/elements.cpp",
"ecmascript/frames.cpp",
"ecmascript/free_object.cpp",
"ecmascript/generator_helper.cpp",
"ecmascript/async_generator_helper.cpp",
"ecmascript/global_env.cpp",
"ecmascript/global_env_constants.cpp",
"ecmascript/ic/ic_runtime.cpp",
"ecmascript/ic/ic_compare_op.cpp",
"ecmascript/ic/invoke_cache.cpp",
"ecmascript/ic/profile_type_info.cpp",
"ecmascript/ic/property_box.cpp",
"ecmascript/ic/proto_change_details.cpp",
"ecmascript/interpreter/frame_handler.cpp",
"ecmascript/interpreter/interpreter.cpp",
"ecmascript/interpreter/interpreter_assembly.cpp",
"ecmascript/interpreter/slow_runtime_stub.cpp",
"ecmascript/intl/locale_helper.cpp",
"ecmascript/jobs/micro_job_queue.cpp",
"ecmascript/jspandafile/js_pandafile.cpp",
"ecmascript/jspandafile/js_pandafile_manager.cpp",
"ecmascript/jspandafile/class_info_extractor.cpp",
"ecmascript/jspandafile/debug_info_extractor.cpp",
"ecmascript/jspandafile/literal_data_extractor.cpp",
"ecmascript/jspandafile/type_literal_extractor.cpp",
"ecmascript/jspandafile/accessor/module_data_accessor.cpp",
"ecmascript/jspandafile/panda_file_translator.cpp",
"ecmascript/jspandafile/js_pandafile_executor.cpp",
"ecmascript/jspandafile/scope_info_extractor.cpp",
"ecmascript/jspandafile/method_literal.cpp",
"ecmascript/jspandafile/program_object.cpp",
"ecmascript/js_api/js_api_arraylist.cpp",
"ecmascript/js_api/js_api_arraylist_iterator.cpp",
"ecmascript/js_api/js_api_deque.cpp",
"ecmascript/js_api/js_api_deque_iterator.cpp",
"ecmascript/js_api/js_api_hashmap.cpp",
"ecmascript/js_api/js_api_hashmap_iterator.cpp",
"ecmascript/js_api/js_api_hashset.cpp",
"ecmascript/js_api/js_api_hashset_iterator.cpp",
"ecmascript/js_api/js_api_lightweightmap.cpp",
"ecmascript/js_api/js_api_lightweightmap_iterator.cpp",
"ecmascript/js_api/js_api_lightweightset.cpp",
"ecmascript/js_api/js_api_lightweightset_iterator.cpp",
"ecmascript/js_api/js_api_linked_list.cpp",
"ecmascript/js_api/js_api_linked_list_iterator.cpp",
"ecmascript/js_api/js_api_list.cpp",
"ecmascript/js_api/js_api_list_iterator.cpp",
"ecmascript/js_api/js_api_plain_array.cpp",
"ecmascript/js_api/js_api_plain_array_iterator.cpp",
"ecmascript/js_api/js_api_queue.cpp",
"ecmascript/js_api/js_api_queue_iterator.cpp",
"ecmascript/js_api/js_api_stack.cpp",
"ecmascript/js_api/js_api_stack_iterator.cpp",
"ecmascript/js_api/js_api_tree_map.cpp",
"ecmascript/js_api/js_api_tree_map_iterator.cpp",
"ecmascript/js_api/js_api_tree_set.cpp",
"ecmascript/js_api/js_api_tree_set_iterator.cpp",
"ecmascript/js_api/js_api_vector.cpp",
"ecmascript/js_api/js_api_vector_iterator.cpp",
"ecmascript/js_arguments.cpp",
"ecmascript/js_array.cpp",
"ecmascript/js_array_iterator.cpp",
"ecmascript/js_arraybuffer.cpp",
"ecmascript/js_async_from_sync_iterator.cpp",
"ecmascript/js_async_function.cpp",
"ecmascript/js_bigint.cpp",
"ecmascript/js_dataview.cpp",
"ecmascript/js_date.cpp",
"ecmascript/js_for_in_iterator.cpp",
"ecmascript/js_finalization_registry.cpp",
"ecmascript/js_file_path.cpp",
"ecmascript/js_function.cpp",
"ecmascript/js_generator_object.cpp",
"ecmascript/js_async_generator_object.cpp",
"ecmascript/js_hclass.cpp",
"ecmascript/js_iterator.cpp",
"ecmascript/js_map.cpp",
"ecmascript/js_map_iterator.cpp",
"ecmascript/method.cpp",
"ecmascript/js_object.cpp",
"ecmascript/js_primitive_ref.cpp",
"ecmascript/js_promise.cpp",
"ecmascript/js_proxy.cpp",
"ecmascript/js_regexp_iterator.cpp",
"ecmascript/js_runtime_options.cpp",
"ecmascript/js_serializer.cpp",
"ecmascript/js_set.cpp",
"ecmascript/js_set_iterator.cpp",
"ecmascript/js_stable_array.cpp",
"ecmascript/js_string_iterator.cpp",
"ecmascript/js_tagged_value.cpp",
"ecmascript/js_thread.cpp",
"ecmascript/js_typed_array.cpp",
"ecmascript/js_weak_container.cpp",
"ecmascript/linked_hash_table.cpp",
"ecmascript/log.cpp",
"ecmascript/message_string.cpp",
"ecmascript/mem/barriers.cpp",
"ecmascript/mem/c_string.cpp",
"ecmascript/mem/chunk.cpp",
"ecmascript/mem/dyn_chunk.cpp",
"ecmascript/mem/full_gc.cpp",
"ecmascript/mem/concurrent_marker.cpp",
"ecmascript/mem/concurrent_sweeper.cpp",
"ecmascript/mem/free_object_list.cpp",
"ecmascript/mem/free_object_set.cpp",
"ecmascript/mem/gc_stats.cpp",
"ecmascript/mem/heap.cpp",
"ecmascript/mem/heap_region_allocator.cpp",
"ecmascript/mem/incremental_marker.cpp",
"ecmascript/mem/linear_space.cpp",
"ecmascript/mem/mem_controller.cpp",
"ecmascript/mem/mem_map_allocator.cpp",
"ecmascript/mem/native_area_allocator.cpp",
"ecmascript/mem/parallel_evacuator.cpp",
"ecmascript/mem/parallel_marker.cpp",
"ecmascript/mem/partial_gc.cpp",
"ecmascript/mem/regexp_cached_chunk.cpp",
"ecmascript/mem/stw_young_gc.cpp",
"ecmascript/mem/space.cpp",
"ecmascript/mem/sparse_space.cpp",
"ecmascript/mem/verification.cpp",
"ecmascript/mem/work_manager.cpp",
"ecmascript/mem/allocation_inspector.cpp",
"ecmascript/module/js_module_manager.cpp",
"ecmascript/module/js_dynamic_import.cpp",
"ecmascript/module/js_module_namespace.cpp",
"ecmascript/module/js_module_record.cpp",
"ecmascript/module/js_module_source_text.cpp",
"ecmascript/module/js_module_deregister.cpp",
"ecmascript/module/module_data_extractor.cpp",
"ecmascript/module/module_path_helper.cpp",
"ecmascript/napi/jsnapi.cpp",
"ecmascript/object_factory.cpp",
"ecmascript/object_operator.cpp",
"ecmascript/patch/patch_loader.cpp",
"ecmascript/patch/quick_fix_manager.cpp",
"ecmascript/pgo_profiler/ap_file/pgo_file_info.cpp",
"ecmascript/pgo_profiler/pgo_profiler.cpp",
"ecmascript/pgo_profiler/pgo_profiler_decoder.cpp",
"ecmascript/pgo_profiler/pgo_profiler_encoder.cpp",
"ecmascript/pgo_profiler/pgo_profiler_info.cpp",
"ecmascript/pgo_profiler/pgo_profiler_layout.cpp",
"ecmascript/pgo_profiler/pgo_profiler_manager.cpp",
"ecmascript/pgo_profiler/pgo_utils.cpp",
"ecmascript/pgo_profiler/ap_file/pgo_method_type_set.cpp",
"ecmascript/pgo_profiler/types/pgo_profile_type.cpp",
"ecmascript/property_accessor.cpp",
"ecmascript/stackmap/ark_stackmap_builder.cpp",
"ecmascript/stackmap/ark_stackmap_parser.cpp",
"ecmascript/stackmap/llvm_stackmap_parser.cpp",
"ecmascript/stackmap/llvm_stackmap_type.cpp",
"ecmascript/subtyping_operator.cpp",
"ecmascript/taskpool/taskpool.cpp",
"ecmascript/taskpool/runner.cpp",
"ecmascript/taskpool/task_queue.cpp",
"ecmascript/layout_info.cpp",
"ecmascript/regexp/regexp_executor.cpp",
"ecmascript/regexp/regexp_opcode.cpp",
"ecmascript/regexp/regexp_parser.cpp",
"ecmascript/regexp/regexp_parser_cache.cpp",
"ecmascript/shared_mm/shared_mm.cpp",
"ecmascript/tagged_dictionary.cpp",
"ecmascript/tagged_hash_array.cpp",
"ecmascript/tagged_list.cpp",
"ecmascript/tagged_node.cpp",
"ecmascript/tagged_tree.cpp",
"ecmascript/template_string.cpp",
"ecmascript/vtable.cpp",
"ecmascript/waiter_list.cpp",
"ecmascript/weak_vector.cpp",
"ecmascript/stubs/runtime_stubs.cpp",
"ecmascript/ts_types/ts_type.cpp",
"ecmascript/ts_types/ts_type_accessor.cpp",
"ecmascript/ts_types/ts_type_table.cpp",
"ecmascript/ts_types/ts_manager.cpp",
"ecmascript/ts_types/ts_obj_layout_info.cpp",
"ecmascript/ts_types/ts_type_parser.cpp",
"ecmascript/ts_types/ts_type_table_generator.cpp",
"ecmascript/stubs/test_runtime_stubs.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",
]
hitrace_scope_source = []
if (is_ohos && is_standard_system && enable_hitrace) {
hitrace_scope_source += [ "ecmascript/jobs/hitrace_scope.cpp" ]
}
ecma_debugger_source = [
"ecmascript/debugger/debugger_api.cpp",
"ecmascript/debugger/js_debugger.cpp",
"ecmascript/debugger/dropframe_manager.cpp",
"ecmascript/debugger/hot_reload_manager.cpp",
]
ecma_profiler_source = [ "ecmascript/napi/dfx_jsnapi.cpp" ]
if (!is_mingw && !is_mac && target_os != "ios") {
if (ark_compile_mode == "debug") {
ecma_profiler_source += [
"ecmascript/dfx/cpu_profiler/cpu_profiler.cpp",
"ecmascript/dfx/cpu_profiler/sampling_processor.cpp",
"ecmascript/dfx/cpu_profiler/samples_record.cpp",
"ecmascript/dfx/hprof/file_stream.cpp",
"ecmascript/dfx/hprof/heap_profiler.cpp",
"ecmascript/dfx/hprof/heap_profiler_interface.cpp",
"ecmascript/dfx/hprof/heap_root_visitor.cpp",
"ecmascript/dfx/hprof/heap_sampling.cpp",
"ecmascript/dfx/hprof/heap_snapshot.cpp",
"ecmascript/dfx/hprof/heap_snapshot_json_serializer.cpp",
"ecmascript/dfx/hprof/heap_tracker.cpp",
"ecmascript/dfx/hprof/string_hashmap.cpp",
"ecmascript/dfx/stackinfo/js_stackgetter.cpp",
"ecmascript/base/block_hook_scope.cpp",
]
}
}
ecma_profiler_source += [
"ecmascript/snapshot/mem/snapshot.cpp",
"ecmascript/snapshot/mem/snapshot_env.cpp",
"ecmascript/snapshot/mem/snapshot_processor.cpp",
]
ecma_platform_source = []
ecma_platform_source += [
"ecmascript/platform/common/map.cpp",
"ecmascript/platform/common/mutex.cpp",
]
config("include_llvm") {
if (compile_llvm_online) {
include_dirs = [
"//third_party/third_party_llvm-project/build/include",
"//third_party/third_party_llvm-project/llvm/include/",
]
} else {
if (is_mingw) {
include_dirs = [
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_windows/llvm/include",
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_windows/build/include",
]
} else if (is_mac || is_ios) {
if (host_cpu == "arm64") {
include_dirs = [
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_arm64/llvm/include",
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_arm64/build/include",
]
} else {
include_dirs = [
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_x64/llvm/include",
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_darwin_x64/build/include",
]
}
} else {
if (current_cpu == "arm64") {
include_dirs = [
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_aarch64/llvm/include",
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts_aarch64/build/include",
]
} else {
include_dirs = [
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/llvm/include",
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/include",
]
}
}
}
}
if (is_mingw) {
ecma_platform_source += [
"ecmascript/platform/windows/backtrace.cpp",
"ecmascript/platform/windows/map.cpp",
"ecmascript/platform/windows/file.cpp",
"ecmascript/platform/windows/os.cpp",
"ecmascript/platform/windows/time.cpp",
"ecmascript/platform/windows/log.cpp",
]
} else {
ecma_platform_source += [
"ecmascript/platform/unix/file.cpp",
"ecmascript/platform/unix/map.cpp",
"ecmascript/platform/unix/time.cpp",
]
if (is_mac) {
ecma_platform_source += [
"ecmascript/platform/unix/mac/os.cpp",
"ecmascript/platform/unix/mac/backtrace.cpp",
"ecmascript/platform/unix/mac/log.cpp",
]
} else if (target_os == "ios") {
ecma_platform_source += [
"ecmascript/platform/unix/mac/os.cpp",
"ecmascript/platform/unix/mac/backtrace.cpp",
"ecmascript/platform/common/log.cpp",
]
} else if (is_ohos || target_os == "android") {
ecma_platform_source += [
"ecmascript/platform/unix/linux/os.cpp",
"ecmascript/platform/unix/ohos/backtrace.cpp",
"ecmascript/platform/common/log.cpp",
]
} else if (is_linux) {
ecma_platform_source += [
"ecmascript/platform/unix/linux/os.cpp",
"ecmascript/platform/unix/linux/backtrace.cpp",
"ecmascript/platform/common/log.cpp",
]
} else {
print("Invalid os!")
assert(false)
}
}
if (enable_target_compilation) {
ecma_platform_source += [ "ecmascript/platform/unix/ohos/directory.cpp" ]
} else if (is_mingw) {
ecma_platform_source += [ "ecmascript/platform/windows/directory.cpp" ]
} else {
ecma_platform_source += [ "ecmascript/platform/unix/directory.cpp" ]
}
ohos_source_set("libark_jsruntime_set") {
stack_protector_ret = false
if (is_ohos && is_standard_system) {
stub_an_file_path = "/system/lib64/${arkcompiler_relative_lib_path}/stub.an"
} else {
stub_an_file_path =
rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an")
}
defines = [ "STUB_AN_FILE=\"${stub_an_file_path}\"" ]
target_builtins_dts_path =
"/system/lib64/${arkcompiler_relative_lib_path}/lib_ark_builtins.d.abc"
defines += [ "TARGET_BUILTINS_DTS_PATH=\"${target_builtins_dts_path}\"" ]
if (current_cpu == "arm64") {
defines += [ "ENABLE_POSTFORK_FORCEEXPAND" ]
}
sources = ecma_source
sources += ecma_profiler_source
sources += ecma_debugger_source
sources += hitrace_scope_source
sources += ecma_platform_source
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
public_configs += [ ":include_llvm" ]
configs = [
"$js_root:ark_jsruntime_common_config",
"$js_root:asm_interp_enable_config",
]
cflags_cc = []
if (is_standard_system || target_os == "android" || target_os == "ios") {
cflags_cc += [ "-fvisibility=hidden" ]
}
external_deps = []
deps = []
if (!is_cross_platform_build) {
external_deps += [ "runtime_core:arkfile_header_deps" ]
} else {
deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
}
if (is_ohos && is_standard_system && !is_cross_platform_build &&
defined(global_parts_info) && defined(global_parts_info.qos_manager)) {
defines += [ "ENABLE_QOS" ]
external_deps += [ "qos_manager:qos" ]
}
if (enable_target_compilation) {
external_deps += [ "c_utils:utils" ]
}
# hiviewdfx libraries
external_deps += hiviewdfx_ext_deps
deps += hiviewdfx_deps
if (ark_standalone_build || target_os == "ios") {
deps += [ "$ark_third_party_root/zlib:libz" ]
} else {
deps += [ "$ark_third_party_root/zlib:shared_libz" ]
}
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_source_set("libark_js_intl_set") {
stack_protector_ret = false
sources = intl_sources
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
configs = [ "$js_root:ark_jsruntime_common_config" ]
cflags_cc = []
if (is_standard_system || target_os == "android" || target_os == "ios") {
cflags_cc += [ "-fvisibility=hidden" ]
}
external_deps = []
deps = []
if (!is_cross_platform_build) {
external_deps += [ "runtime_core:arkfile_header_deps" ]
} else {
deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
}
# hiviewdfx libraries
external_deps += hiviewdfx_ext_deps
deps += hiviewdfx_deps
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
config("ark_jsruntime_test_nolto") {
cflags_cc = [ "-fno-lto" ]
}
ohos_source_set("libark_jsruntime_test_set") {
stack_protector_ret = false
sources = ecma_source
sources += intl_sources
sources += ecma_profiler_source
sources += ecma_debugger_source
sources += hitrace_scope_source
sources += ecma_platform_source
defines = [ "OHOS_UNIT_TEST" ]
if (is_ohos && is_standard_system) {
stub_an_file_path = "/system/lib64/${arkcompiler_relative_lib_path}/stub.an"
} else {
stub_an_file_path =
rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an")
}
defines += [ "STUB_AN_FILE=\"${stub_an_file_path}\"" ]
target_builtins_dts_path =
"/system/lib64/${arkcompiler_relative_lib_path}/lib_ark_builtins.d.abc"
defines += [ "TARGET_BUILTINS_DTS_PATH=\"${target_builtins_dts_path}\"" ]
deps = [
"$ark_third_party_root/icu/icu4c:shared_icui18n",
"$ark_third_party_root/icu/icu4c:shared_icuuc",
]
external_deps = []
if (!is_cross_platform_build) {
external_deps += [ "runtime_core:arkfile_header_deps" ]
} else {
deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
}
if (enable_coverage) {
ldflags = [ "--coverage" ]
cflags_cc = [ "--coverage" ]
}
if ((current_cpu == "amd64" || current_cpu == "x64" ||
current_cpu == "x86_64" || current_cpu == "arm64") && !is_mingw &&
!is_mac && target_os != "ios") {
deps += [ "ecmascript/compiler:libark_stub_set" ]
} else {
deps += [ "$js_root/ecmascript/compiler:libark_mock_stub_set" ]
}
if (enable_leak_check || is_asan) {
defines += [ "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK" ]
}
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
public_configs += [ ":include_llvm" ]
configs = [
"$js_root:ark_jsruntime_common_config",
"$js_root:asm_interp_enable_config",
"$js_root:icu_path_test_config",
"$js_root:ark_jsruntime_test_nolto",
]
if (enable_target_compilation) {
external_deps += [ "c_utils:utils" ]
}
# hiviewdfx libraries
external_deps += hiviewdfx_ext_deps
deps += hiviewdfx_deps
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_source_set("libark_jsruntime_static") {
stack_protector_ret = false
deps = [
":libark_js_intl_set",
":libark_jsruntime_set",
]
external_deps = []
if (!is_cross_platform_build) {
external_deps += [ "runtime_core:arkfile_header_deps" ]
} else {
deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
}
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
if ((current_cpu == "amd64" || current_cpu == "x64" ||
current_cpu == "x86_64" || current_cpu == "arm64") && !is_mingw &&
!is_mac && target_os != "ios") {
deps += [ "ecmascript/compiler:libark_stub_set" ]
} else {
deps += [ "$js_root/ecmascript/compiler:libark_mock_stub_set" ]
}
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_shared_library("libark_jsruntime") {
stack_protector_ret = false
deps = [
":libark_jsruntime_static",
sdk_libc_secshared_dep,
]
external_deps = []
if (!is_cross_platform_build) {
external_deps += [ "runtime_core:libarkfile_static" ]
} else {
deps += [ "$ark_root/libpandafile:libarkfile_static" ]
}
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
if (is_ohos && is_standard_system && !is_debug) {
version_script = "libark_jsruntime.map"
}
# hiviewdfx libraries
external_deps += hiviewdfx_ext_deps
deps += hiviewdfx_deps
if (!enable_ark_intl) {
external_deps += [ "i18n:intl_util" ]
}
install_enable = true
if (!is_mingw && !is_mac) {
output_extension = "so"
}
if (!is_standard_system) {
relative_install_dir = "ark"
}
if (target_os == "android" && !ark_standalone_build) {
libs = [ "log" ]
version_script = "libark_jsruntime.map"
}
if (target_os == "ios" || ark_standalone_build) {
deps += [
"$ark_third_party_root/icu/icu4c:static_icui18n",
"$ark_third_party_root/icu/icu4c:static_icuuc",
]
} else {
deps += [
"$ark_third_party_root/icu/icu4c:shared_icui18n",
"$ark_third_party_root/icu/icu4c:shared_icuuc",
]
}
innerapi_tags = [ "platformsdk_indirect" ]
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_shared_library("libark_jsruntime_test") {
stack_protector_ret = false
deps = [
":libark_jsruntime_test_set",
"$ark_root/libpandafile:libarkfile_static",
]
public_configs = [ "$js_root:ark_jsruntime_public_config" ]
public_configs += [ ":include_llvm" ]
ldflags = []
if (enable_coverage) {
ldflags += [ "--coverage" ]
cflags_cc = [ "--coverage" ]
}
if (!ark_standalone_build) {
ldflags += [ "-Wl,--lto-O0" ]
}
install_enable = false
if (!is_mingw && !is_mac) {
output_extension = "so"
}
subsystem_name = "test"
}
ohos_prebuilt_etc("app_aot_white_list") {
relative_install_dir = "ark"
source = "$js_root/ecmascript/ohos/app_aot_white_list.conf"
# Set the subsystem name
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}