From 74df851f6921bd5798001d3c6dd3cdfba5d68c26 Mon Sep 17 00:00:00 2001 From: Chongwei Su Date: Thu, 20 Apr 2023 21:04:07 +0800 Subject: [PATCH] Modify size macros to be externally configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modify macros INPUTJS_BUFFER_SIZE,SNAPSHOT_BUFFER_SIZE,BMS_TASK_HEAP_SIZE,JS_TASK_HEAP_SIZE issue:https://gitee.com/openharmony/third_party_jerryscript/issues/I6XGZ7 Signed-off-by: Chongwei Su --- BUILD.gn | 10 ++++++++++ bundle.json | 8 +++++++- engine.gni | 4 ++++ jerry-core/BUILD.gn | 10 ++++++++++ jerry-ext/BUILD.gn | 10 ++++++++++ jerry-port/default/BUILD.gn | 10 ++++++++++ 6 files changed, 51 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 8d929a0d..cb45a892 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -69,6 +69,16 @@ if (defined(ohos_lite)) { # is on lite Os for ipcamera if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } + defines += + [ "INPUTJS_BUFFER_SIZE=${thirdparty_jerryscript_inputjs_buffer_size}" ] + defines += [ + "SNAPSHOT_BUFFER_SIZE=${thirdparty_jerryscript_snapshot_buffer_size}", + ] + defines += + [ "BMS_TASK_HEAP_SIZE=${thirdparty_jerryscript_bms_task_heap_size}" ] + defines += + [ "JS_TASK_HEAP_SIZE=${thirdparty_jerryscript_js_task_heap_size}" ] + cflags = [ "-Wno-unused-function", "-Wno-sign-compare", diff --git a/bundle.json b/bundle.json index 747e5b43..be1d40e3 100644 --- a/bundle.json +++ b/bundle.json @@ -13,7 +13,13 @@ "name": "thirdparty_jerryscript", "subsystem": "", "syscap": [], - "features": ["thirdparty_jerryscript_enable_external_context"], + "features": [ + "thirdparty_jerryscript_enable_external_context", + "thirdparty_jerryscript_inputjs_buffer_size", + "thirdparty_jerryscript_snapshot_buffer_size", + "thirdparty_jerryscript_bms_task_heap_size", + "thirdparty_jerryscript_js_task_heap_size" + ], "adapted_system_type": [], "rom": "", "ram": "", diff --git a/engine.gni b/engine.gni index 420aa27a..7ee69a24 100644 --- a/engine.gni +++ b/engine.gni @@ -13,6 +13,10 @@ declare_args() { thirdparty_jerryscript_enable_external_context = true + thirdparty_jerryscript_inputjs_buffer_size = 32768 + thirdparty_jerryscript_snapshot_buffer_size = 24576 + thirdparty_jerryscript_bms_task_heap_size = 64 + thirdparty_jerryscript_js_task_heap_size = 64 } engine_path = "//third_party/jerryscript" diff --git a/jerry-core/BUILD.gn b/jerry-core/BUILD.gn index fbabc70d..53283ccf 100644 --- a/jerry-core/BUILD.gn +++ b/jerry-core/BUILD.gn @@ -263,6 +263,16 @@ if (board_toolchain_type != "iccarm") { if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } + defines += + [ "INPUTJS_BUFFER_SIZE=${thirdparty_jerryscript_inputjs_buffer_size}" ] + defines += [ + "SNAPSHOT_BUFFER_SIZE=${thirdparty_jerryscript_snapshot_buffer_size}", + ] + defines += + [ "BMS_TASK_HEAP_SIZE=${thirdparty_jerryscript_bms_task_heap_size}" ] + defines += + [ "JS_TASK_HEAP_SIZE=${thirdparty_jerryscript_js_task_heap_size}" ] + include_dirs = jerry_core_includes include_dirs += [ "$port_path", diff --git a/jerry-ext/BUILD.gn b/jerry-ext/BUILD.gn index 0d289df8..8afc631f 100644 --- a/jerry-ext/BUILD.gn +++ b/jerry-ext/BUILD.gn @@ -84,6 +84,16 @@ if (board_toolchain_type == "iccarm") { if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } + defines += + [ "INPUTJS_BUFFER_SIZE=${thirdparty_jerryscript_inputjs_buffer_size}" ] + defines += [ + "SNAPSHOT_BUFFER_SIZE=${thirdparty_jerryscript_snapshot_buffer_size}", + ] + defines += + [ "BMS_TASK_HEAP_SIZE=${thirdparty_jerryscript_bms_task_heap_size}" ] + defines += + [ "JS_TASK_HEAP_SIZE=${thirdparty_jerryscript_js_task_heap_size}" ] + include_dirs = jerry_ext_include_dirs include_dirs += [ "${core_path}", diff --git a/jerry-port/default/BUILD.gn b/jerry-port/default/BUILD.gn index 12b7bf77..e3f58f53 100644 --- a/jerry-port/default/BUILD.gn +++ b/jerry-port/default/BUILD.gn @@ -69,6 +69,16 @@ if (board_toolchain_type == "iccarm") { if (thirdparty_jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } + defines += + [ "INPUTJS_BUFFER_SIZE=${thirdparty_jerryscript_inputjs_buffer_size}" ] + defines += [ + "SNAPSHOT_BUFFER_SIZE=${thirdparty_jerryscript_snapshot_buffer_size}", + ] + defines += + [ "BMS_TASK_HEAP_SIZE=${thirdparty_jerryscript_bms_task_heap_size}" ] + defines += + [ "JS_TASK_HEAP_SIZE=${thirdparty_jerryscript_js_task_heap_size}" ] + include_dirs = jerry_port_default_include_dirs include_dirs += [ "${core_path}", -- Gitee