From fe4ef1f08b2875cc5972ff275723791167bec1e1 Mon Sep 17 00:00:00 2001 From: x00416111 Date: Tue, 12 Aug 2025 15:06:03 +0800 Subject: [PATCH] Sync code Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICSK0F Change-Id: Icfd786581a77cdb037e43c525530f452b3ccfb46 Signed-off-by: x00416111 --- ecmascript/js_thread.cpp | 22 ++++++++++++++-------- ecmascript/js_thread.h | 1 + 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ecmascript/js_thread.cpp b/ecmascript/js_thread.cpp index dddf0df12d..93fdff6b70 100644 --- a/ecmascript/js_thread.cpp +++ b/ecmascript/js_thread.cpp @@ -258,14 +258,8 @@ JSThread::~JSThread() globalDebugStorage_ = nullptr; } - if (glueData_.loadMegaICCache_ != nullptr) { - delete glueData_.loadMegaICCache_; - glueData_.loadMegaICCache_ = nullptr; - } - if (glueData_.storeMegaICCache_ != nullptr) { - delete glueData_.storeMegaICCache_; - glueData_.storeMegaICCache_ = nullptr; - } + ClearMegaIC(); + if (glueData_.propertiesCache_ != nullptr) { delete glueData_.propertiesCache_; glueData_.propertiesCache_ = nullptr; @@ -505,6 +499,18 @@ void JSThread::IterateMegaIC(RootVisitor &v) } } +void JSThread::ClearMegaIC() +{ + if (glueData_.loadMegaICCache_ != nullptr) { + delete glueData_.loadMegaICCache_; + glueData_.loadMegaICCache_ = nullptr; + } + if (glueData_.storeMegaICCache_ != nullptr) { + delete glueData_.storeMegaICCache_; + glueData_.storeMegaICCache_ = nullptr; + } +} + void JSThread::Iterate(RootVisitor &visitor) { if (!glueData_.exception_.IsHole()) { diff --git a/ecmascript/js_thread.h b/ecmascript/js_thread.h index 48dfa108a8..6ac6e1e9ee 100644 --- a/ecmascript/js_thread.h +++ b/ecmascript/js_thread.h @@ -335,6 +335,7 @@ public: void IterateJitCodeMap(const JitCodeMapVisitor &updater); void IterateMegaIC(RootVisitor &v); + void ClearMegaIC(); void IterateHandleWithCheck(RootVisitor &visitor); -- Gitee