diff --git a/interfaces/inner_api/napi/native_node_api.h b/interfaces/inner_api/napi/native_node_api.h index cc75dd040e66eb9991d2b9972c356078e4498e02..dbdf69e1a8747b75c537a36335dff98de8edc426 100644 --- a/interfaces/inner_api/napi/native_node_api.h +++ b/interfaces/inner_api/napi/native_node_api.h @@ -21,6 +21,7 @@ #include #include +#include "ecmascript/napi/include/jsnapi_expo.h" #include "js_native_api.h" #include "node_api.h" #include "native_common.h" @@ -124,4 +125,6 @@ NAPI_EXTERN napi_status napi_get_shared_array_buffer_info(napi_env env, size_t* byte_length); NAPI_EXTERN napi_status napi_encode(napi_env env, napi_value src, napi_value* result); NAPI_EXTERN napi_status napi_is_bitvector(napi_env env, napi_value value, bool* result); +NAPI_EXTERN napi_status napi_set_stackinfo(napi_env env, const panda::StackInfo &info); +NAPI_EXTERN napi_status napi_get_stackinfo(napi_env env, panda::StackInfo *result); #endif /* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_NODE_API_H */ diff --git a/native_engine/native_api.cpp b/native_engine/native_api.cpp index 1409ab3a7ea2a0666031e8a247153b8ecb84d444..b8efd04bbf3c438e2bdfbc134d5713993998a6e8 100644 --- a/native_engine/native_api.cpp +++ b/native_engine/native_api.cpp @@ -4152,3 +4152,19 @@ NAPI_EXTERN napi_status napi_is_bitvector(napi_env env, napi_value value, bool* return napi_clear_last_error(env); } + +NAPI_EXTERN napi_status napi_set_stackinfo(napi_env env, panda::StackInfo &info) +{ + auto vm = reinterpret_cast(env)->GetEcmaVm(); + panda::JSNApi::SetStackInfo(vm, info); + return napi_clear_last_error(env); +} + +NAPI_EXTERN napi_status napi_get_stackinfo(napi_env env, panda::StackInfo *result) +{ + auto vm = reinterpret_cast(env)->GetEcmaVm(); + auto res = panda::JSNApi::GetStackInfo(vm); + (*result).stackStart = res.stackStart; + (*result).stackSize = res.stackSize; + return napi_clear_last_error(env); +} \ No newline at end of file