From e7773d6bb26d13f489dff5a9cba6d1ab546cfc2f Mon Sep 17 00:00:00 2001 From: Vsevolod Pukhov Date: Fri, 29 Sep 2023 17:53:15 +0300 Subject: [PATCH] Allow es2panda build with disabled ecmascript Signed-off-by: Vsevolod Pukhov --- BUILD.gn | 4 ++-- CMakeLists.txt | 6 ++++-- HostTools.cmake | 1 - runtime/CMakeLists.txt | 1 + runtime/base/json_parser.h | 3 +-- runtime/js_eval.cpp | 2 +- subproject_sources.gn | 2 +- tests/CMakeLists.txt | 9 --------- 8 files changed, 10 insertions(+), 18 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 028602e91..db62ba31f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -15,7 +15,7 @@ import("//ark/runtime_core/ark_config.gni") import("//build/ohos.gni") group("ark_packages") { - deps = ["$ark_root/plugins/ecmascript/es2panda/aot:es2panda"] + deps = ["$ark_es2panda_root/aot:es2panda"] } group("ark_host_linux_tools_packages") { @@ -63,7 +63,7 @@ config("runtime") { "$ark_root_gen_dir", ] configs = [ - "es2panda:libes2panda_public_config", + "$ark_es2panda_root:libes2panda_public_config", "$ark_root/assembler:arkassembler_public_config", "$ark_root/libpandafile:arkfile_public_config", ] diff --git a/CMakeLists.txt b/CMakeLists.txt index 7154af07a..95d78f49b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,10 @@ panda_target_compile_definitions(arkbytecodeopt PUBLIC -DENABLE_BYTECODE_OPT -DA add_custom_target(ecmascript_tests COMMENT "Running ecmascript test suites") +if(TARGET es2panda_tests) + add_dependencies(ecmascript_tests es2panda_tests) +endif() + # NB! ADDING THIS PROPERTY IS ALLOWED ONLY IN SPECIAL CASES. DO NOT COPY-PASTE IT. set_target_properties(ecmascript_tests PROPERTIES first-level-tests-dependency TRUE) add_dependencies(tests ecmascript_tests) @@ -36,8 +40,6 @@ if(PANDA_WITH_TOOLCHAIN) add_subdirectory(assembler) add_subdirectory(isa) add_subdirectory(irtoc_scripts) - add_subdirectory(es2panda) - add_dependencies(panda_bins es2panda) endif() add_subdirectory(bytecode_optimizer) diff --git a/HostTools.cmake b/HostTools.cmake index c775085f0..e03d65577 100644 --- a/HostTools.cmake +++ b/HostTools.cmake @@ -1,4 +1,3 @@ -list(APPEND HOST_TOOLS_TARGETS es2panda) list(APPEND HOST_TOOLS_TARGETS irtoc_ecmascript_fastpath) list(APPEND HOST_TOOLS_BYPRODUCTS "${host_tools_build_dir}/irtoc/irtoc_ecmascript/irtoc_ecmascript_fastpath/irtoc_ecmascript_fastpath.o" diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 44e62a1c9..e3f0a6ab3 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -224,6 +224,7 @@ panda_target_include_directories(arkruntime_obj PUBLIC ${PANDA_ECMASCRIPT_PLUGIN_SOURCE}/runtime ${PANDA_BINARY_ROOT}/compiler/generated ${PANDA_BINARY_ROOT}/plugins/ecmascript/ecmastdlib + ${ES2PANDA_PATH} ${ECMA_GEN_DIR} ) diff --git a/runtime/base/json_parser.h b/runtime/base/json_parser.h index 5d35d4df7..713da40f7 100644 --- a/runtime/base/json_parser.h +++ b/runtime/base/json_parser.h @@ -29,7 +29,6 @@ #include "plugins/ecmascript/runtime/js_handle.h" #include "plugins/ecmascript/runtime/js_tagged_value.h" #include "plugins/ecmascript/runtime/object_factory.h" -#include "plugins/ecmascript/es2panda/util/helpers.h" #include "libpandabase/utils/utf.h" namespace panda::ecmascript::base { @@ -135,7 +134,7 @@ private: std::string str_num(current_, end_ + 1); current_ = end_; auto d = std::stod(str_num); - if (es2panda::util::Helpers::IsInteger(d)) { + if (static_cast(d) == d) { return JSTaggedValue(static_cast(d)); } return JSTaggedValue(d); diff --git a/runtime/js_eval.cpp b/runtime/js_eval.cpp index ebbee0d5d..9519011e3 100644 --- a/runtime/js_eval.cpp +++ b/runtime/js_eval.cpp @@ -19,7 +19,7 @@ #include "plugins/ecmascript/runtime/base/builtins_base.h" #include "plugins/ecmascript/runtime/internal_call_params.h" #include "plugins/ecmascript/runtime/interpreter/interpreter-inl.h" -#include "plugins/ecmascript/es2panda/es2panda.h" +#include "plugins/ecmascript/es2panda/es2panda.h" // TODO(vpukhov): adjust es2panda path #include "assembler/assembly-emitter.h" namespace panda::ecmascript { diff --git a/subproject_sources.gn b/subproject_sources.gn index c2424dd46..b1af2ce63 100644 --- a/subproject_sources.gn +++ b/subproject_sources.gn @@ -62,7 +62,7 @@ arkbytecodeopt_deps = [ arkruntime_deps = [ "$ark_root/assembler:libarkassembler_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", - "$_plugin_dir/es2panda:libes2panda_frontend_static", + "$ark_es2panda_root:libes2panda_frontend_static", ] runtime_yamls = [ "runtime/ecma_runtime.yaml" ] diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e63dc22b7..a3c5a33ed 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -247,15 +247,6 @@ function(add_test_file_ecma) endfunction() -if(CMAKE_CROSSCOMPILING) - ExternalProject_Get_Property(panda_host_tools binary_dir) - set(es2panda_target panda_host_tools-build) - set(es2panda_bin "${binary_dir}/plugins/ecmascript/es2panda/aot/es2panda") -else() - set(es2panda_target es2panda) - set(es2panda_bin $) -endif() - if (CMAKE_CROSSCOMPILING AND PANDA_TARGET_ARM64) # ecmascript tests # add_test_file_ecma(FILE "${CMAKE_CURRENT_SOURCE_DIR}/ecmascript-tests/js-bitops-bitwise-and.pa" COMPILER_OPTIONS --compiler-hotness-threshold=0) -- Gitee