diff --git a/BUILD.gn b/BUILD.gn index bffca4ab4d991d8f23bcd8b17816e09ee386e536..dbf364a1fc92c1daf0b735995be59294be78c1fe 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -26,6 +26,7 @@ if (defined(ohos_lite)) { # is on lite Os for ipcamera } } else { import("//build/ohos.gni") + import("//third_party/jerryscript/engine.gni") config("jerryscript_config") { defines = [ "JERRY_SNAPSHOT_SAVE=1", @@ -47,7 +48,6 @@ if (defined(ohos_lite)) { # is on lite Os for ipcamera "JERRY_CPOINTER_32_BIT=0", "JERRY_DEBUGGER=1", "JERRY_ES2015=0", - "JERRY_EXTERNAL_CONTEXT=1", "JERRY_FUNCTION_BACKTRACE", "JERRY_FUNCTION_NAME", "JERRY_GC_LIMIT=(0)", @@ -65,6 +65,9 @@ if (defined(ohos_lite)) { # is on lite Os for ipcamera "JERRY_VALGRIND=0", "JERRY_VM_EXEC_STOP=0", ] + if (thirdparty_jerryscript_enable_external_context == true) { + defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] + } cflags = [ "-Wno-unused-function", "-Wno-sign-compare", diff --git a/bundle.json b/bundle.json index 4b3076e5e424c5aa836c88483d756e8895ab783c..747e5b4318732d4d14dabb5458303321b5eff5f2 100644 --- a/bundle.json +++ b/bundle.json @@ -13,7 +13,7 @@ "name": "thirdparty_jerryscript", "subsystem": "", "syscap": [], - "features": [], + "features": ["thirdparty_jerryscript_enable_external_context"], "adapted_system_type": [], "rom": "", "ram": "", diff --git a/engine.gni b/engine.gni index 35b3e8b63991ca60240d0c6a8aebdcd2c0182b96..e1d67c961f8b2f2025f6cc89fbcb69bf13fd5606 100644 --- a/engine.gni +++ b/engine.gni @@ -11,6 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +declare_args() { + thirdparty_jerryscript_enable_external_context = true +} + engine_path = "//third_party/jerryscript" core_path = "${engine_path}/jerry-core" diff --git a/jerry-core/BUILD.gn b/jerry-core/BUILD.gn index 1cec29ebde341a739380db4ad3ded77f88c16739..454ff955e44308f68662e09ad72860707da93542 100644 --- a/jerry-core/BUILD.gn +++ b/jerry-core/BUILD.gn @@ -239,7 +239,6 @@ if (board_toolchain_type != "iccarm") { "JERRY_GC_LIMIT=(0)", "JERRY_CPOINTER_32_BIT=0", "JERRY_ERROR_MESSAGES=1", - "JERRY_EXTERNAL_CONTEXT=1", "JERRY_PARSER=1", "JERRY_LINE_INFO=1", "JERRY_LOGGING=0", @@ -260,6 +259,9 @@ if (board_toolchain_type != "iccarm") { "SNAPSHOT_BUFFER_SIZE=48*1024", "_BSD_SOURCE", ] + if (thirdparty_jerryscript_enable_external_context == true) { + defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] + } include_dirs = jerry_core_includes include_dirs += [ "$port_path", diff --git a/jerry-core/api/jerry.c b/jerry-core/api/jerry.c index 923e0f9691859d0e73cfcbbc54091871001b799b..c5e0216a441d99972084949d576c8cce4bc25950 100644 --- a/jerry-core/api/jerry.c +++ b/jerry-core/api/jerry.c @@ -2871,6 +2871,14 @@ jerry_call_function (const jerry_value_t func_obj_val, /**< function object to c jerry_assert_api_available (); #if ENABLED (JERRY_DEBUGGER) + /** + * Clear flag JERRY_DEBUGGER_VM_STOP and set debugger_stop_context Null everytime jerry's debugger call a function. + * This could solve the problem that jerry's debugger stops at an unexpected line when re-entering a function after a + * step-operation. + */ + JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_STOP); + JERRY_CONTEXT (debugger_stop_context) = NULL; + if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) { if (jerry_debugger_receive (NULL)) { JERRY_DEBUG_MSG ("resume"); diff --git a/jerry-ext/BUILD.gn b/jerry-ext/BUILD.gn index 0ee09d9082f7502d83483dbe4ddac3bb65498c2c..c9926dcbea2726b7aee1ea9013d638a89bafeda3 100644 --- a/jerry-ext/BUILD.gn +++ b/jerry-ext/BUILD.gn @@ -62,7 +62,6 @@ if (board_toolchain_type == "iccarm") { "JERRY_GC_LIMIT=(0)", "JERRY_CPOINTER_32_BIT=0", "JERRY_ERROR_MESSAGES=1", - "JERRY_EXTERNAL_CONTEXT=1", "JERRY_PARSER=1", "JERRY_LINE_INFO=1", "JERRY_LOGGING=0", @@ -82,6 +81,9 @@ if (board_toolchain_type == "iccarm") { "INPUTJS_BUFFER_SIZE=64*1024", "SNAPSHOT_BUFFER_SIZE=48*1024", ] + if (thirdparty_jerryscript_enable_external_context == true) { + defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] + } 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 dd7c5c9b7066e845dd10cd6d052a8854f1fa76b1..d2c46713496dc538f0d9f3ec18aace191df76d28 100644 --- a/jerry-port/default/BUILD.gn +++ b/jerry-port/default/BUILD.gn @@ -47,7 +47,6 @@ if (board_toolchain_type == "iccarm") { "JERRY_GC_LIMIT=(0)", "JERRY_CPOINTER_32_BIT=0", "JERRY_ERROR_MESSAGES=1", - "JERRY_EXTERNAL_CONTEXT=1", "JERRY_PARSER=1", "JERRY_LINE_INFO=1", "JERRY_LOGGING=0", @@ -67,6 +66,9 @@ if (board_toolchain_type == "iccarm") { "INPUTJS_BUFFER_SIZE=64*1024", "SNAPSHOT_BUFFER_SIZE=48*1024", ] + if (thirdparty_jerryscript_enable_external_context == true) { + defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] + } include_dirs = jerry_port_default_include_dirs include_dirs += [ "${core_path}",