diff --git a/runtime/intrinsics-inl.h b/runtime/intrinsics-inl.h index 1e7344c241978032f4978bf90a6e7823ee314bf5..734b65ba7c91b7c7a4f3217d57d7ee0d6daa584f 100644 --- a/runtime/intrinsics-inl.h +++ b/runtime/intrinsics-inl.h @@ -1348,10 +1348,11 @@ INLINE_ECMA_INTRINSICS uint64_t NewlexenvDyn(JSThread *thread, uint16_t num_slot // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t CopylexenvDyn(JSThread *thread) { + [[maybe_unused]] EcmaHandleScope handleScope(thread); auto factory = thread->GetEcmaVM()->GetFactory(); - LexicalEnv *oldEnv = GetLexicalEnv(thread); - JSTaggedValue parentEnv = oldEnv->GetParentEnv(); - SetLexicalEnv(thread, parentEnv); + JSHandle oldEnv(thread, GetLexicalEnv(thread)); + JSHandle parentEnv(thread, oldEnv->GetParentEnv()); + SetLexicalEnv(thread, parentEnv.GetTaggedValue()); array_size_t numOfSlots = oldEnv->GetLength(); JSTaggedValue res = FastRuntimeStub::NewLexicalEnvDyn(thread, factory, numOfSlots); @@ -1361,7 +1362,7 @@ INLINE_ECMA_INTRINSICS uint64_t CopylexenvDyn(JSThread *thread) return res.GetRawData(); } } - LexicalEnv::Cast(res.GetHeapObject())->SetParentEnv(thread, parentEnv); + LexicalEnv::Cast(res.GetHeapObject())->SetParentEnv(thread, parentEnv.GetTaggedValue()); SetLexicalEnv(thread, res); for (array_size_t i = 0; i < numOfSlots; i++) {