From ab0315cca6931c0deaa751070134bb5412198243 Mon Sep 17 00:00:00 2001 From: jiadexiang Date: Wed, 22 Feb 2023 19:54:53 +0800 Subject: [PATCH] Description: support some es2015 feature IssueNo:I6H2DT Feature or Bugfix: Feature Binary Source:No Signed-off-by: jiadexiang --- BUILD.gn | 3 ++- engine.gni | 15 +++++++++++++++ jerry-core/BUILD.gn | 3 ++- jerry-core/config.h | 32 ++++++++++++++++++++++++++++++++ jerry-ext/BUILD.gn | 2 +- jerry-port/default/BUILD.gn | 2 +- 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index dbf364a1..8d929a0d 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -35,6 +35,7 @@ if (defined(ohos_lite)) { # is on lite Os for ipcamera "JERRY_HEAPDUMP", "JERRY_REF_TRACKER", ] + defines += es6_support_defines cflags = [ "-Wno-unused-function", "-Wno-sign-compare", @@ -47,7 +48,6 @@ if (defined(ohos_lite)) { # is on lite Os for ipcamera defines = [ "JERRY_CPOINTER_32_BIT=0", "JERRY_DEBUGGER=1", - "JERRY_ES2015=0", "JERRY_FUNCTION_BACKTRACE", "JERRY_FUNCTION_NAME", "JERRY_GC_LIMIT=(0)", @@ -65,6 +65,7 @@ if (defined(ohos_lite)) { # is on lite Os for ipcamera "JERRY_VALGRIND=0", "JERRY_VM_EXEC_STOP=0", ] + defines += es6_support_defines if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } diff --git a/engine.gni b/engine.gni index e1d67c96..420aa27a 100644 --- a/engine.gni +++ b/engine.gni @@ -26,3 +26,18 @@ ext_path = "${engine_path}/jerry-ext" libm_path = "${engine_path}/jerry-libm" port_path = "${engine_path}/jerry-port" + +# support es6 with limitation +es6_support_defines = [ + "JERRY_ES2015=1", + "JERRY_ES2015_BUILTIN_TYPEDARRAY=1", + "JERRY_ES2015_BUILTIN_SET=1", + "JERRY_ES2015_BUILTIN_PROMISE=1", + "JERRY_ES2015_BUILTIN_PROXY=1", + "JERRY_ES2015_MODULE_SYSTEM=1", + "JERRY_ES2015_BUILTIN_MAP=1", + "JERRY_ES2015_BUILTIN_WEAKMAP=0", + "JERRY_ES2015_BUILTIN_WEAKSET=0", + "JERRY_ES2015_BUILTIN_DATAVIEW=0", + "JERRY_ES2015_BUILTIN_REFLECT=0", +] diff --git a/jerry-core/BUILD.gn b/jerry-core/BUILD.gn index 454ff955..fbabc70d 100644 --- a/jerry-core/BUILD.gn +++ b/jerry-core/BUILD.gn @@ -223,6 +223,7 @@ if (board_toolchain_type != "iccarm") { "JERRY_FUNCTION_BACKTRACE", "JERRY_STACK_LIMIT=0", ] + jerry_core_defines += es6_support_defines } else { jerry_core_sources += [ "api/external-context-helpers.c", @@ -245,7 +246,6 @@ if (board_toolchain_type != "iccarm") { "JERRY_DEBUGGER=0", "JERRY_MEM_GC_BEFORE_EACH_ALLOC=0", "JERRY_PARSER_DUMP_BYTE_CODE=0", - "JERRY_ES2015=0", "JERRY_REGEXP_STRICT_MODE=0", "JERRY_REGEXP_DUMP_BYTE_CODE=0", "JERRY_SNAPSHOT_EXEC=1", @@ -259,6 +259,7 @@ if (board_toolchain_type != "iccarm") { "SNAPSHOT_BUFFER_SIZE=48*1024", "_BSD_SOURCE", ] + defines += es6_support_defines if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } diff --git a/jerry-core/config.h b/jerry-core/config.h index a70b1592..ebde3dbb 100644 --- a/jerry-core/config.h +++ b/jerry-core/config.h @@ -83,23 +83,55 @@ #ifdef JERRY_FOR_IAR_CONFIG # error "Should not define this macro on WIN simulator!" #endif +#ifndef JERRY_BUILTIN_REGEXP # define JERRY_BUILTIN_REGEXP 0 +#endif + +#ifndef JERRY_ES2015 # define JERRY_ES2015 0 +#endif + +#ifndef JERRY_ES2015_BUILTIN_TYPEDARRAY # define JERRY_ES2015_BUILTIN_TYPEDARRAY 1 +#endif + //Maximum size of heap in kilobytes +#ifndef JERRY_GLOBAL_HEAP_SIZE # define JERRY_GLOBAL_HEAP_SIZE (64) +#endif + +#ifndef JERRY_DISABLE_HEAVY_DEBUG # define JERRY_DISABLE_HEAVY_DEBUG +#endif + +#ifndef JERRY_ERROR_MESSAGES # define JERRY_ERROR_MESSAGES 1 +#endif + +#ifndef JERRY_LINE_INFO # define JERRY_LINE_INFO 1 +#endif + +#ifndef JERRY_MEM_STATS # define JERRY_MEM_STATS 1 +#endif + +#ifndef JERRY_SNAPSHOT_EXEC # define JERRY_SNAPSHOT_EXEC 1 +#endif + +#ifndef JERRY_SNAPSHOT_SAVE # define JERRY_SNAPSHOT_SAVE 1 +#endif + #ifndef JERRY_LOGGING # define JERRY_LOGGING 1 #endif // following config controls temp changes in jerry for debugger function with IDE +#ifndef ACE_DEBUGGER_CUSTOM # define ACE_DEBUGGER_CUSTOM +#endif #ifndef JERRY_BUILTIN_EVAL_DISABLED // disable builtin eval() function diff --git a/jerry-ext/BUILD.gn b/jerry-ext/BUILD.gn index c9926dcb..0d289df8 100644 --- a/jerry-ext/BUILD.gn +++ b/jerry-ext/BUILD.gn @@ -68,7 +68,6 @@ if (board_toolchain_type == "iccarm") { "JERRY_DEBUGGER=0", "JERRY_MEM_GC_BEFORE_EACH_ALLOC=0", "JERRY_PARSER_DUMP_BYTE_CODE=0", - "JERRY_ES2015=0", "JERRY_REGEXP_STRICT_MODE=0", "JERRY_REGEXP_DUMP_BYTE_CODE=0", "JERRY_SNAPSHOT_EXEC=1", @@ -81,6 +80,7 @@ if (board_toolchain_type == "iccarm") { "INPUTJS_BUFFER_SIZE=64*1024", "SNAPSHOT_BUFFER_SIZE=48*1024", ] + defines += es6_support_defines if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } diff --git a/jerry-port/default/BUILD.gn b/jerry-port/default/BUILD.gn index d2c46713..12b7bf77 100644 --- a/jerry-port/default/BUILD.gn +++ b/jerry-port/default/BUILD.gn @@ -53,7 +53,6 @@ if (board_toolchain_type == "iccarm") { "JERRY_DEBUGGER=0", "JERRY_MEM_GC_BEFORE_EACH_ALLOC=0", "JERRY_PARSER_DUMP_BYTE_CODE=0", - "JERRY_ES2015=0", "JERRY_REGEXP_STRICT_MODE=0", "JERRY_REGEXP_DUMP_BYTE_CODE=0", "JERRY_SNAPSHOT_EXEC=1", @@ -66,6 +65,7 @@ if (board_toolchain_type == "iccarm") { "INPUTJS_BUFFER_SIZE=64*1024", "SNAPSHOT_BUFFER_SIZE=48*1024", ] + defines += es6_support_defines if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } -- Gitee