Skip to content

Commit 3de878f

Browse files
committed
Fix for type sharing bug and core changes for leak fix.
1 parent e26a586 commit 3de878f

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

lib/Jsrt/Jsrt.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4233,15 +4233,18 @@ CHAKRA_API JsTTDNotifyLongLivedReferenceAdd(_In_ JsValueRef value)
42334233
return JsErrorNoCurrentContext;
42344234
}
42354235

4236-
Js::RecyclableObject* obj = Js::RecyclableObject::FromVar(value);
4237-
if(obj->GetScriptContext()->IsTTDRecordModeEnabled())
4236+
if (Js::RecyclableObject::Is(value))
42384237
{
4239-
if(obj->GetScriptContext()->ShouldPerformRecordAction())
4238+
Js::RecyclableObject* obj = Js::RecyclableObject::FromVar(value);
4239+
if (obj->GetScriptContext()->IsTTDRecordModeEnabled())
42404240
{
4241-
threadContext->TTDLog->RecordJsRTAddWeakRootRef(_actionEntryPopper, (Js::Var)value);
4242-
}
4241+
if (obj->GetScriptContext()->ShouldPerformRecordAction())
4242+
{
4243+
threadContext->TTDLog->RecordJsRTAddWeakRootRef(_actionEntryPopper, (Js::Var)value);
4244+
}
42434245

4244-
threadContext->TTDContext->AddRootRef_Record(TTD_CONVERT_OBJ_TO_LOG_PTR_ID(obj), obj);
4246+
threadContext->TTDContext->AddRootRef_Record(TTD_CONVERT_OBJ_TO_LOG_PTR_ID(obj), obj);
4247+
}
42454248
}
42464249

42474250
return JsNoError;

lib/Runtime/Debug/TTSnapObjects.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ namespace TTD
271271
//
272272
void StdPropertyRestore(const SnapObject* snpObject, Js::DynamicObject* obj, InflateMap* inflator)
273273
{
274+
obj->GetDynamicType()->GetTypeHandler()->EnsureObjectReady(obj);
275+
274276
//Many protos are set at creation, don't mess with them if they are already correct
275277
if(snpObject->SnapType->PrototypeVar != nullptr)
276278
{

lib/Runtime/Library/ScriptFunction.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,11 @@ using namespace Js;
526526
extractor->MarkVisitVar(this->cachedScopeObj);
527527
}
528528

529+
if (this->GetComputedNameVar() != nullptr)
530+
{
531+
extractor->MarkVisitVar(this->GetComputedNameVar());
532+
}
533+
529534
if (this->GetHomeObj() != nullptr)
530535
{
531536
extractor->MarkVisitVar(this->GetHomeObj());
@@ -594,6 +599,11 @@ using namespace Js;
594599
this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->cachedScopeObj, _u("_cachedScopeObj"));
595600
}
596601

602+
if (this->GetComputedNameVar() != nullptr)
603+
{
604+
this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->GetComputedNameVar(), _u("_computedName"));
605+
}
606+
597607
if (this->GetHomeObj() != nullptr)
598608
{
599609
this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->GetHomeObj(), _u("_homeObj"));

lib/Runtime/Library/ScriptFunction.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ namespace Js
4343
}
4444
virtual Var GetComputedNameVar() const override { return this->computedNameVar; }
4545
virtual void SetComputedNameVar(Var computedNameVar) override { this->computedNameVar = computedNameVar; }
46-
47-
#if ENABLE_TTD
48-
virtual void MarkVisitKindSpecificPtrs(TTD::SnapshotExtractor* extractor)
49-
{
50-
__super::MarkVisitKindSpecificPtrs(extractor);
51-
if (this->computedNameVar != nullptr)
52-
{
53-
extractor->MarkVisitVar(this->computedNameVar);
54-
}
55-
}
56-
#endif
5746
};
5847

5948
template <class BaseClass>

0 commit comments

Comments
 (0)