mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 16:13:49 +00:00
trigger compress-gc by kill signal
Signed-off-by: lukai <lukai25@huawei.com>
This commit is contained in:
parent
c18add63d8
commit
ff103d88b4
@ -787,6 +787,7 @@ private:
|
||||
class PUBLIC_API JSNApi {
|
||||
public:
|
||||
// JSVM
|
||||
enum class PUBLIC_API TRIGGER_GC_TYPE : uint8_t { SEMI_GC, OLD_GC, COMPRESS_FULL_GC };
|
||||
static EcmaVM *CreateJSVM(const RuntimeOption &option);
|
||||
static void DestoryJSVM(EcmaVM *ecmaVm);
|
||||
|
||||
@ -801,8 +802,7 @@ public:
|
||||
static void ExecutePendingJob(const EcmaVM *vm);
|
||||
|
||||
// Memory
|
||||
static void TriggerGC(const EcmaVM *vm);
|
||||
|
||||
static void TriggerGC(const EcmaVM *vm, TRIGGER_GC_TYPE gcType = TRIGGER_GC_TYPE::SEMI_GC);
|
||||
// Exception
|
||||
static void ThrowException(const EcmaVM *vm, Local<JSValueRef> error);
|
||||
static Local<ObjectRef> GetUncaughtException(const EcmaVM *vm);
|
||||
|
@ -185,10 +185,22 @@ void JSNApi::DestoryJSVM(EcmaVM *ecmaVm)
|
||||
}
|
||||
}
|
||||
|
||||
void JSNApi::TriggerGC(const EcmaVM *vm)
|
||||
void JSNApi::TriggerGC(const EcmaVM *vm, TRIGGER_GC_TYPE gcType)
|
||||
{
|
||||
if (vm->GetJSThread() != nullptr && vm->IsInitialized()) {
|
||||
vm->CollectGarbage(ecmascript::TriggerGCType::SEMI_GC);
|
||||
switch (gcType) {
|
||||
case TRIGGER_GC_TYPE::SEMI_GC:
|
||||
vm->CollectGarbage(ecmascript::TriggerGCType::SEMI_GC);
|
||||
break;
|
||||
case TRIGGER_GC_TYPE::OLD_GC:
|
||||
vm->CollectGarbage(ecmascript::TriggerGCType::OLD_GC);
|
||||
break;
|
||||
case TRIGGER_GC_TYPE::COMPRESS_FULL_GC:
|
||||
vm->CollectGarbage(ecmascript::TriggerGCType::COMPRESS_FULL_GC);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user