@@ -4080,6 +4080,25 @@ void DumpRecyclerObjectGraph()
40804080#endif
40814081
40824082#if ENABLE_NATIVE_CODEGEN
4083+ bool ThreadContext::IsNativeAddressHelper (void * pCodeAddr, Js::ScriptContext* currentScriptContext)
4084+ {
4085+ bool isNativeAddr = false ;
4086+ if (currentScriptContext && currentScriptContext->GetJitFuncRangeCache () != nullptr )
4087+ {
4088+ isNativeAddr = currentScriptContext->GetJitFuncRangeCache ()->IsNativeAddr (pCodeAddr);
4089+ }
4090+
4091+ for (Js::ScriptContext *scriptContext = scriptContextList; scriptContext && !isNativeAddr; scriptContext = scriptContext->next )
4092+ {
4093+ if (scriptContext == currentScriptContext || scriptContext->GetJitFuncRangeCache () == nullptr )
4094+ {
4095+ continue ;
4096+ }
4097+ isNativeAddr = scriptContext->GetJitFuncRangeCache ()->IsNativeAddr (pCodeAddr);
4098+ }
4099+ return isNativeAddr;
4100+ }
4101+
40834102BOOL ThreadContext::IsNativeAddress (void * pCodeAddr, Js::ScriptContext* currentScriptContext)
40844103{
40854104#if ENABLE_OOP_NATIVE_CODEGEN
@@ -4103,24 +4122,9 @@ BOOL ThreadContext::IsNativeAddress(void * pCodeAddr, Js::ScriptContext* current
41034122 HRESULT hr = JITManager::GetJITManager ()->IsNativeAddr (this ->m_remoteThreadContextInfo , (intptr_t )pCodeAddr, &result);
41044123 JITManager::HandleServerCallResult (hr, RemoteCallType::HeapQuery);
41054124#endif
4106-
4107- bool isNativeAddr = false ;
4108- if (currentScriptContext && currentScriptContext->GetJitFuncRangeCache () != nullptr )
4109- {
4110- isNativeAddr = currentScriptContext->GetJitFuncRangeCache ()->IsNativeAddr (pCodeAddr);
4111- }
4112-
4113- for (Js::ScriptContext *scriptContext = scriptContextList; scriptContext && !isNativeAddr; scriptContext = scriptContext->next )
4114- {
4115- if (scriptContext->GetJitFuncRangeCache () == nullptr || scriptContext == currentScriptContext)
4116- {
4117- continue ;
4118- }
4119- isNativeAddr = scriptContext->GetJitFuncRangeCache ()->IsNativeAddr (pCodeAddr);
4120- }
4121-
4125+ bool isNativeAddr = IsNativeAddressHelper (pCodeAddr, currentScriptContext);
41224126#if DBG
4123- Assert (result == (isNativeAddr? 1 : 0 ));
4127+ Assert (result == (isNativeAddr? TRUE : FALSE ));
41244128#endif
41254129 return isNativeAddr;
41264130 }
@@ -4138,17 +4142,7 @@ BOOL ThreadContext::IsNativeAddress(void * pCodeAddr, Js::ScriptContext* current
41384142#if DBG
41394143 AutoCriticalSection autoLock (&this ->codePageAllocators .cs );
41404144#endif
4141-
4142- bool isNativeAddr = false ;
4143- for (Js::ScriptContext *scriptContext = scriptContextList; scriptContext && !isNativeAddr; scriptContext = scriptContext->next )
4144- {
4145- if (scriptContext->GetJitFuncRangeCache () == nullptr )
4146- {
4147- continue ;
4148- }
4149- isNativeAddr = scriptContext->GetJitFuncRangeCache ()->IsNativeAddr (pCodeAddr);
4150- }
4151-
4145+ bool isNativeAddr = IsNativeAddressHelper (pCodeAddr, currentScriptContext);
41524146#if DBG
41534147 Assert (this ->codePageAllocators .IsInNonPreReservedPageAllocator (pCodeAddr) == isNativeAddr);
41544148#endif
0 commit comments