Skip to content

Commit 6621be8

Browse files
committed
[MERGE #5409 @mrkmarron] Fix for type sharing bug and core changes for leak fix.
Merge pull request #5409 from mrkmarron:fix10
2 parents c9296fa + 3de878f commit 6621be8

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
@@ -524,6 +524,11 @@ using namespace Js;
524524
extractor->MarkVisitVar(this->cachedScopeObj);
525525
}
526526

527+
if (this->GetComputedNameVar() != nullptr)
528+
{
529+
extractor->MarkVisitVar(this->GetComputedNameVar());
530+
}
531+
527532
if (this->GetHomeObj() != nullptr)
528533
{
529534
extractor->MarkVisitVar(this->GetHomeObj());
@@ -592,6 +597,11 @@ using namespace Js;
592597
this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->cachedScopeObj, _u("_cachedScopeObj"));
593598
}
594599

600+
if (this->GetComputedNameVar() != nullptr)
601+
{
602+
this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->GetComputedNameVar(), _u("_computedName"));
603+
}
604+
595605
if (this->GetHomeObj() != nullptr)
596606
{
597607
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)