Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
wyrichte committed Mar 22, 2019
1 parent 9270bb2 commit 3a68197
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 57 deletions.
21 changes: 2 additions & 19 deletions lib/Runtime/Base/FunctionBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3302,11 +3302,6 @@ namespace Js
{
entryPoint = currentEntryPoint;
}
if (currentEntryPoint->lboNativeAddr <= codeAddress && currentEntryPoint->lboNativeAddr + currentEntryPoint->lboCodeSize > codeAddress)
{
entryPoint = currentEntryPoint;
}

});

return entryPoint;
Expand Down Expand Up @@ -8386,11 +8381,7 @@ namespace Js
bool isValid = hasSharedPropertyGuard && sharedPropertyGuard->IsValid();
if (isValid)
{
scriptContext->GetThreadContext()->RegisterLazyBailout(
propertyId,
this,
GetNativeEntryPointData()->GetHasLazyBailOut()
);
scriptContext->GetThreadContext()->RegisterLazyBailout(propertyId, this);
}
else
{
Expand Down Expand Up @@ -9140,7 +9131,7 @@ namespace Js
jitMode(ExecutionMode::Interpreter),
functionProxy(functionProxy),
nextEntryPoint(nullptr),
shouldNotDelete(false)
retAddrNotModified(false)
{
}

Expand Down Expand Up @@ -9284,12 +9275,6 @@ namespace Js
}

void FunctionEntryPointInfo::Invalidate(bool prolongEntryPoint)
{
return;
}


FunctionEntryPointInfo* FunctionEntryPointInfo::InvalidateRet(bool prolongEntryPoint)
{
Assert(!this->functionProxy->IsDeferred());
FunctionBody* functionBody = this->functionProxy->GetFunctionBody();
Expand Down Expand Up @@ -9348,8 +9333,6 @@ namespace Js
ThreadContext* threadContext = this->functionProxy->GetScriptContext()->GetThreadContext();
threadContext->QueueFreeOldEntryPointInfoIfInScript(this);
}

return entryPoint;
}

void FunctionEntryPointInfo::Expire()
Expand Down
5 changes: 1 addition & 4 deletions lib/Runtime/Base/FunctionBody.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,7 @@ namespace Js

Field(uint32) callsCount;
Field(uint32) lastCallsCount;
Field(DWORD_PTR) lboNativeAddr;
Field(ptrdiff_t) lboCodeSize;
Field(bool) shouldNotDelete;
Field(bool) retAddrNotModified;

private:
Field(ExecutionMode) jitMode;
Expand All @@ -641,7 +639,6 @@ namespace Js
ExecutionMode GetJitMode() const;
void SetJitMode(const ExecutionMode jitMode);

FunctionEntryPointInfo* InvalidateRet(bool prolongEntryPoint);
virtual void Invalidate(bool prolongEntryPoint) override;
virtual void Expire() override;
virtual void EnterExpirableCollectMode() override;
Expand Down
37 changes: 8 additions & 29 deletions lib/Runtime/Base/ThreadContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3568,7 +3568,7 @@ ThreadContext::RegisterSharedPropertyGuard(Js::PropertyId propertyId)
}

void
ThreadContext::RegisterLazyBailout(Js::PropertyId propertyId, Js::EntryPointInfo* entryPoint, bool hasLazyBailOut)
ThreadContext::RegisterLazyBailout(Js::PropertyId propertyId, Js::EntryPointInfo* entryPoint)
{
Assert(entryPoint);

Expand All @@ -3584,11 +3584,6 @@ ThreadContext::RegisterLazyBailout(Js::PropertyId propertyId, Js::EntryPointInfo
// We use lazyBailOutEntryPoints' EntryPointDictionary functionality not as a value lookup but
// rather as a means to verify that an entryPoint for the given propertyGuardEntry exists.
propertyGuardEntry->lazyBailOutEntryPoints->UncheckedAdd(entryPoint, NULL);

if (hasLazyBailOut)
{
propertyGuardEntry->hasLazyBailOut = true;
}
}

void
Expand Down Expand Up @@ -3711,11 +3706,7 @@ ThreadContext::InvalidatePropertyGuardEntry(
this->recyclableData->constructorCacheInvalidationCount = 0;
}
}

/*
if (propertyGuardEntry->hasLazyBailOut)
{
*/

if (propertyGuardEntry->lazyBailOutEntryPoints && propertyGuardEntry->lazyBailOutEntryPoints->Count() > 0)
{
Assert(propertyGuardEntry->lazyBailOutEntryPoints);
Expand Down Expand Up @@ -3759,45 +3750,33 @@ ThreadContext::InvalidatePropertyGuardEntry(

if (!didConvertRetAddrToThunk)
{
functionEntryPoint->shouldNotDelete = true;
functionEntryPoint->retAddrNotModified = true;
}
}
}
}
}
}
/*
}
*/

if (propertyGuardEntry->lazyBailOutEntryPoints && propertyGuardEntry->lazyBailOutEntryPoints->Count() > 0)
{
if (!propertyGuardEntry->hasLazyBailOut)
{
int a = 5;
a++;

}

propertyGuardEntry->lazyBailOutEntryPoints->Map([=](Js::EntryPointInfo* lazyBailOutEntryPoint, BYTE& dummy, const RecyclerWeakReference<Js::EntryPointInfo>* infoWeakRef)
{
if (lazyBailOutEntryPoint->IsCleanedUp())
{
return;
}
OUTPUT_TRACE2(Js::LazyBailoutPhase, lazyBailOutEntryPoint->GetFunctionBody(), _u("Lazy bailout - Invalidation due to property: %s \n"), propertyRecord->GetBuffer());
if (!((Js::FunctionEntryPointInfo*)(lazyBailOutEntryPoint))->shouldNotDelete)

if (!((Js::FunctionEntryPointInfo*)lazyBailOutEntryPoint)->retAddrNotModified)
{
/*Js::FunctionEntryPointInfo* newEntryPoint = */((Js::FunctionEntryPointInfo*)(lazyBailOutEntryPoint))->InvalidateRet(true);
((Js::FunctionEntryPointInfo*)(lazyBailOutEntryPoint))->shouldNotDelete = false;
lazyBailOutEntryPoint->Invalidate(true);
((Js::FunctionEntryPointInfo*)lazyBailOutEntryPoint)->retAddrNotModified = false;
}
//newEntryPoint->lboCodeSize = lazyBailOutEntryPoint->GetCodeSize();
//newEntryPoint->lboNativeAddr = lazyBailOutEntryPoint->GetNativeAddress();

});

// TODO: make function.
propertyGuardEntry->lazyBailOutEntryPoints->Clear();
propertyGuardEntry->hasLazyBailOut = false;
}
}

Expand Down
7 changes: 2 additions & 5 deletions lib/Runtime/Base/ThreadContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,8 @@ class ThreadContext sealed :
Field(Js::PropertyGuard*) sharedGuard;
Field(PropertyGuardHashSet) uniqueGuards;
Field(EntryPointDictionary*) lazyBailOutEntryPoints;
Field(bool) hasLazyBailOut; // Even though this PropertyGuardEntry may have one or more lazyBailOutEntryPoints, that is not
// enough information to verify that any one of thse lazyBailOutEntryPoints is connected to a
// LazyBailOut bailout tag.

PropertyGuardEntry(Recycler* recycler) : sharedGuard(nullptr), uniqueGuards(recycler), lazyBailOutEntryPoints(nullptr), hasLazyBailOut(false) {}
PropertyGuardEntry(Recycler* recycler) : sharedGuard(nullptr), uniqueGuards(recycler), lazyBailOutEntryPoints(nullptr) {}
};

public:
Expand Down Expand Up @@ -1358,7 +1355,7 @@ class ThreadContext sealed :

#if ENABLE_NATIVE_CODEGEN
Js::PropertyGuard* RegisterSharedPropertyGuard(Js::PropertyId propertyId);
void RegisterLazyBailout(Js::PropertyId propertyId, Js::EntryPointInfo* entryPoint, bool hasLazyBailOut);
void RegisterLazyBailout(Js::PropertyId propertyId, Js::EntryPointInfo* entryPoint);
void RegisterUniquePropertyGuard(Js::PropertyId propertyId, Js::PropertyGuard* guard);
void RegisterUniquePropertyGuard(Js::PropertyId propertyId, RecyclerWeakReference<Js::PropertyGuard>* guardWeakRef);
void RegisterConstructorCache(Js::PropertyId propertyId, Js::ConstructorCache* cache);
Expand Down

0 comments on commit 3a68197

Please sign in to comment.