@@ -3711,8 +3711,12 @@ ThreadContext::InvalidatePropertyGuardEntry(
37113711 this ->recyclableData ->constructorCacheInvalidationCount = 0 ;
37123712 }
37133713 }
3714-
3714+
3715+ /*
37153716 if (propertyGuardEntry->hasLazyBailOut)
3717+ {
3718+ */
3719+ if (propertyGuardEntry->lazyBailOutEntryPoints && propertyGuardEntry->lazyBailOutEntryPoints ->Count () > 0 )
37163720 {
37173721 Assert (propertyGuardEntry->lazyBailOutEntryPoints );
37183722 Assert (propertyGuardEntry->lazyBailOutEntryPoints ->Count () > 0 );
@@ -3748,15 +3752,23 @@ ThreadContext::InvalidatePropertyGuardEntry(
37483752 // should set a flag on functionEntryPoint->scriptContext when ConvertFuncRetAddrToLazyBailOutThunk
37493753 // returns false. Then, when an expected scenario completes, we should unset that flag. Once
37503754 // ScriptContext closes, we should assert that the flag should be off.
3751- functionEntryPoint->ConvertFuncRetAddrToLazyBailOutThunk (
3755+ bool didConvertRetAddrToThunk = functionEntryPoint->ConvertFuncRetAddrToLazyBailOutThunk (
37523756 stackWalker.GetCurrentAddressOfInstructionPointer (),
37533757 static_cast <BYTE*>(stackWalker.GetFramePointer ())
37543758 );
3759+
3760+ if (!didConvertRetAddrToThunk)
3761+ {
3762+ functionEntryPoint->shouldNotDelete = true ;
3763+ }
37553764 }
37563765 }
37573766 }
37583767 }
37593768 }
3769+ /*
3770+ }
3771+ */
37603772
37613773 if (propertyGuardEntry->lazyBailOutEntryPoints && propertyGuardEntry->lazyBailOutEntryPoints ->Count () > 0 )
37623774 {
@@ -3767,16 +3779,20 @@ ThreadContext::InvalidatePropertyGuardEntry(
37673779
37683780 }
37693781
3770- propertyGuardEntry->lazyBailOutEntryPoints ->Map ([=](Js::FunctionEntryPointInfo * lazyBailOutEntryPoint, BYTE& dummy, const RecyclerWeakReference<Js::EntryPointInfo>* infoWeakRef)
3782+ propertyGuardEntry->lazyBailOutEntryPoints ->Map ([=](Js::EntryPointInfo * lazyBailOutEntryPoint, BYTE& dummy, const RecyclerWeakReference<Js::EntryPointInfo>* infoWeakRef)
37713783 {
37723784 if (lazyBailOutEntryPoint->IsCleanedUp ())
37733785 {
37743786 return ;
37753787 }
37763788 OUTPUT_TRACE2 (Js::LazyBailoutPhase, lazyBailOutEntryPoint->GetFunctionBody (), _u (" Lazy bailout - Invalidation due to property: %s \n " ), propertyRecord->GetBuffer ());
3777- Js::FunctionEntryPointInfo* newEntryPoint = lazyBailOutEntryPoint->InvalidateRet (true );
3778- newEntryPoint->lboCodeSize = lazyBailOutEntryPoint->GetCodeSize ();
3779- newEntryPoint->lboNativeAddr = lazyBailOutEntryPoint->GetNativeAddress ();
3789+ if (!((Js::FunctionEntryPointInfo*)(lazyBailOutEntryPoint))->shouldNotDelete )
3790+ {
3791+ /* Js::FunctionEntryPointInfo* newEntryPoint = */ ((Js::FunctionEntryPointInfo*)(lazyBailOutEntryPoint))->InvalidateRet (true );
3792+ ((Js::FunctionEntryPointInfo*)(lazyBailOutEntryPoint))->shouldNotDelete = false ;
3793+ }
3794+ // newEntryPoint->lboCodeSize = lazyBailOutEntryPoint->GetCodeSize();
3795+ // newEntryPoint->lboNativeAddr = lazyBailOutEntryPoint->GetNativeAddress();
37803796 });
37813797
37823798 // TODO: make function.
0 commit comments