|
|
@@ -8846,31 +8846,38 @@ namespace Js
|
|
|
{
|
|
|
if (this->GetState() != CleanedUp)
|
|
|
{
|
|
|
- // Unregister xdataInfo before OnCleanup() which may release xdataInfo->address
|
|
|
#if ENABLE_NATIVE_CODEGEN
|
|
|
-#if defined(TARGET_64)
|
|
|
- if (this->xdataInfo != nullptr)
|
|
|
- {
|
|
|
- XDataAllocator::Unregister(this->xdataInfo);
|
|
|
- HeapDelete(this->xdataInfo);
|
|
|
- this->xdataInfo = nullptr;
|
|
|
- }
|
|
|
-#elif defined(_M_ARM)
|
|
|
+ void* functionTable = nullptr;
|
|
|
+#if PDATA_ENABLED
|
|
|
if (this->xdataInfo != nullptr)
|
|
|
{
|
|
|
+#ifdef _WIN32
|
|
|
+ functionTable = this->xdataInfo->functionTable;
|
|
|
+#endif
|
|
|
XDataAllocator::Unregister(this->xdataInfo);
|
|
|
+#if defined(_M_ARM32_OR_ARM64)
|
|
|
if (JITManager::GetJITManager()->IsOOPJITEnabled())
|
|
|
+#endif
|
|
|
{
|
|
|
HeapDelete(this->xdataInfo);
|
|
|
}
|
|
|
this->xdataInfo = nullptr;
|
|
|
}
|
|
|
-#endif
|
|
|
#endif
|
|
|
|
|
|
- this->OnCleanup(isShutdown);
|
|
|
+ this->OnCleanup(isShutdown, &functionTable);
|
|
|
+
|
|
|
+#if PDATA_ENABLED && defined(_WIN32)
|
|
|
+ // functionTable is not transferred somehow, delete in-thread
|
|
|
+ if (functionTable)
|
|
|
+ {
|
|
|
+ if (!DelayDeletingFunctionTable::AddEntry(functionTable))
|
|
|
+ {
|
|
|
+ NtdllLibrary::Instance->DeleteGrowableFunctionTable(functionTable);
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
|
|
|
-#if ENABLE_NATIVE_CODEGEN
|
|
|
FreeJitTransferData();
|
|
|
|
|
|
if (this->bailoutRecordMap != nullptr)
|
|
|
@@ -8992,7 +8999,15 @@ namespace Js
|
|
|
// Reset the entry point upon a lazy bailout.
|
|
|
this->Reset(true);
|
|
|
Assert(this->nativeAddress != nullptr);
|
|
|
- FreeNativeCodeGenAllocation(GetScriptContext(), this->nativeAddress, this->thunkAddress);
|
|
|
+
|
|
|
+ void* functionTable = nullptr;
|
|
|
+#if PDATA_ENABLED && defined(_WIN32)
|
|
|
+ if (this->xdataInfo)
|
|
|
+ {
|
|
|
+ functionTable = this->xdataInfo->functionTable;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ FreeNativeCodeGenAllocation(GetScriptContext(), this->nativeAddress, this->thunkAddress, &functionTable);
|
|
|
this->nativeAddress = nullptr;
|
|
|
this->jsMethod = nullptr;
|
|
|
}
|
|
|
@@ -9088,7 +9103,7 @@ namespace Js
|
|
|
return functionProxy->GetFunctionBody();
|
|
|
}
|
|
|
|
|
|
- void FunctionEntryPointInfo::OnCleanup(bool isShutdown)
|
|
|
+ void FunctionEntryPointInfo::OnCleanup(bool isShutdown, void** functionTable)
|
|
|
{
|
|
|
if (this->IsCodeGenDone())
|
|
|
{
|
|
|
@@ -9099,19 +9114,7 @@ namespace Js
|
|
|
HeapDelete(this->inlineeFrameMap);
|
|
|
this->inlineeFrameMap = nullptr;
|
|
|
}
|
|
|
-#if PDATA_ENABLED
|
|
|
- if (this->xdataInfo != nullptr)
|
|
|
- {
|
|
|
- XDataAllocator::Unregister(this->xdataInfo);
|
|
|
-#if defined(_M_ARM32_OR_ARM64)
|
|
|
- if (JITManager::GetJITManager()->IsOOPJITEnabled())
|
|
|
-#endif
|
|
|
- {
|
|
|
- HeapDelete(this->xdataInfo);
|
|
|
- }
|
|
|
- this->xdataInfo = nullptr;
|
|
|
- }
|
|
|
-#endif
|
|
|
+
|
|
|
#endif
|
|
|
|
|
|
if(nativeEntryPointProcessed)
|
|
|
@@ -9162,7 +9165,8 @@ namespace Js
|
|
|
|
|
|
if (validationCookie == currentCookie)
|
|
|
{
|
|
|
- scriptContext->FreeFunctionEntryPoint((Js::JavascriptMethod)this->GetNativeAddress(), this->GetThunkAddress());
|
|
|
+ scriptContext->FreeFunctionEntryPoint((Js::JavascriptMethod)this->GetNativeAddress(), this->GetThunkAddress(), functionTable);
|
|
|
+ *functionTable = nullptr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -9422,7 +9426,7 @@ namespace Js
|
|
|
|
|
|
//End AsmJs Support
|
|
|
|
|
|
- void LoopEntryPointInfo::OnCleanup(bool isShutdown)
|
|
|
+ void LoopEntryPointInfo::OnCleanup(bool isShutdown, void** functionTable)
|
|
|
{
|
|
|
#ifdef ASMJS_PLAT
|
|
|
if (this->IsCodeGenDone() && !this->GetIsTJMode())
|
|
|
@@ -9439,19 +9443,6 @@ namespace Js
|
|
|
HeapDelete(this->inlineeFrameMap);
|
|
|
this->inlineeFrameMap = nullptr;
|
|
|
}
|
|
|
-#if PDATA_ENABLED
|
|
|
- if (this->xdataInfo != nullptr)
|
|
|
- {
|
|
|
- XDataAllocator::Unregister(this->xdataInfo);
|
|
|
-#if defined(_M_ARM32_OR_ARM64)
|
|
|
- if (JITManager::GetJITManager()->IsOOPJITEnabled())
|
|
|
-#endif
|
|
|
- {
|
|
|
- HeapDelete(this->xdataInfo);
|
|
|
- }
|
|
|
- this->xdataInfo = nullptr;
|
|
|
- }
|
|
|
-#endif
|
|
|
#endif
|
|
|
|
|
|
if (!isShutdown)
|
|
|
@@ -9483,7 +9474,8 @@ namespace Js
|
|
|
|
|
|
if (validationCookie == currentCookie)
|
|
|
{
|
|
|
- scriptContext->FreeFunctionEntryPoint(reinterpret_cast<Js::JavascriptMethod>(this->GetNativeAddress()), this->GetThunkAddress());
|
|
|
+ scriptContext->FreeFunctionEntryPoint(reinterpret_cast<Js::JavascriptMethod>(this->GetNativeAddress()), this->GetThunkAddress(), functionTable);
|
|
|
+ *functionTable = nullptr;
|
|
|
}
|
|
|
}
|
|
|
|