Add time-consuming control switches

Add time-consuming control switches

Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAKD9Q

Signed-off-by: sunpeiyu <sunpeiyu1@huawei.com>
Change-Id: I3178eb709be2f289438ea21f360e0f4c235779c3
This commit is contained in:
sunpeiyu 2024-08-15 20:51:32 +08:00
parent 1e2580b81e
commit 14d46f6096
2 changed files with 12 additions and 1 deletions

View File

@ -56,7 +56,8 @@ enum ArkProperties {
// Use DISABLE to adapt to the exsiting ArkProperties in testing scripts.
DISABLE_SHARED_CONCURRENT_MARK = 1 << 22,
ENABLE_ESM_TRACE = 1 << 24,
ENABLE_MODULE_LOG = 1 << 25
ENABLE_MODULE_LOG = 1 << 25,
ENABLE_SERIALIZATION_TIMEOUT_CHECK = 1 << 26
};
// asm interpreter control parsed option
@ -622,6 +623,11 @@ public:
return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_MODULE_LOG) != 0;
}
bool EnableSerializationTimeoutCheck() const
{
return (static_cast<uint32_t>(arkProperties_) & ArkProperties::ENABLE_SERIALIZATION_TIMEOUT_CHECK) != 0;
}
bool WasSetMaxNonmovableSpaceCapacity() const
{
return WasOptionSet(OPTION_MAX_UNMOVABLE_SPACE);

View File

@ -4794,6 +4794,11 @@ bool JSNApi::KeyIsNumber(const char* utf8)
bool JSNApi::IsSerializationTimeoutCheckEnabled(const EcmaVM *vm)
{
CROSS_THREAD_AND_EXCEPTION_CHECK_WITH_RETURN(vm, false);
// Open Control Timeout Consumption
if (const_cast<EcmaVM *>(vm)->GetJSOptions().EnableSerializationTimeoutCheck()) {
return true;
}
// Currently only log trace on main thread
auto jsDebuggerManager = vm->GetJsDebuggerManager();
if (jsDebuggerManager != nullptr) {