1 /** 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "plugins/ets/runtime/interop_js/xgc/xgc_vm_adaptor.h" 17 #include "plugins/ets/runtime/interop_js/interop_context.h" 18 19 #ifdef PANDA_JS_ETS_HYBRID_MODE 20 #include "native_engine/native_reference.h" 21 #include "interfaces/inner_api/napi/native_node_hybrid_api.h" 22 #endif // PANDA_JS_ETS_HYBRID_MODE 23 24 namespace ark::ets::interop::js { 25 MarkFromObject(napi_ref ref)26void XGCVmAdaptor::MarkFromObject([[maybe_unused]] napi_ref ref) 27 { 28 #ifdef PANDA_JS_ETS_HYBRID_MODE 29 napi_mark_from_object(env_, ref); 30 #endif // PANDA_JS_ETS_HYBRID_MODE 31 } 32 StartXRefMarking()33bool XGCVmAdaptor::StartXRefMarking() 34 { 35 ASSERT(ecmaVMIface_ != nullptr); 36 return ecmaVMIface_->StartXRefMarking(); 37 } 38 NotifyXGCInterruption()39void XGCVmAdaptor::NotifyXGCInterruption() 40 { 41 ASSERT(ecmaVMIface_ != nullptr); 42 ecmaVMIface_->NotifyXGCInterruption(); 43 } 44 NapiDeleteReference(napi_ref ref)45napi_status XGCVmAdaptor::NapiDeleteReference(napi_ref ref) 46 { 47 return napi_delete_reference(env_, ref); 48 } 49 50 } // namespace ark::ets::interop::js