Pārlūkot izejas kodu

Fix for type sharing bug and core changes for leak fix.

Mark Marron 7 gadi atpakaļ
vecāks
revīzija
3de878fde6

+ 9 - 6
lib/Jsrt/Jsrt.cpp

@@ -4233,15 +4233,18 @@ CHAKRA_API JsTTDNotifyLongLivedReferenceAdd(_In_ JsValueRef value)
             return JsErrorNoCurrentContext;
         }
 
-        Js::RecyclableObject* obj = Js::RecyclableObject::FromVar(value);
-        if(obj->GetScriptContext()->IsTTDRecordModeEnabled())
+        if (Js::RecyclableObject::Is(value))
         {
-            if(obj->GetScriptContext()->ShouldPerformRecordAction())
+            Js::RecyclableObject* obj = Js::RecyclableObject::FromVar(value);
+            if (obj->GetScriptContext()->IsTTDRecordModeEnabled())
             {
-                threadContext->TTDLog->RecordJsRTAddWeakRootRef(_actionEntryPopper, (Js::Var)value);
-            }
+                if (obj->GetScriptContext()->ShouldPerformRecordAction())
+                {
+                    threadContext->TTDLog->RecordJsRTAddWeakRootRef(_actionEntryPopper, (Js::Var)value);
+                }
 
-            threadContext->TTDContext->AddRootRef_Record(TTD_CONVERT_OBJ_TO_LOG_PTR_ID(obj), obj);
+                threadContext->TTDContext->AddRootRef_Record(TTD_CONVERT_OBJ_TO_LOG_PTR_ID(obj), obj);
+            }
         }
 
         return JsNoError;

+ 2 - 0
lib/Runtime/Debug/TTSnapObjects.cpp

@@ -271,6 +271,8 @@ namespace TTD
         //
         void StdPropertyRestore(const SnapObject* snpObject, Js::DynamicObject* obj, InflateMap* inflator)
         {
+            obj->GetDynamicType()->GetTypeHandler()->EnsureObjectReady(obj);
+
             //Many protos are set at creation, don't mess with them if they are already correct
             if(snpObject->SnapType->PrototypeVar != nullptr)
             {

+ 10 - 0
lib/Runtime/Library/ScriptFunction.cpp

@@ -526,6 +526,11 @@ using namespace Js;
             extractor->MarkVisitVar(this->cachedScopeObj);
         }
 
+        if (this->GetComputedNameVar() != nullptr)
+        {
+            extractor->MarkVisitVar(this->GetComputedNameVar());
+        }
+
         if (this->GetHomeObj() != nullptr)
         {
             extractor->MarkVisitVar(this->GetHomeObj());
@@ -594,6 +599,11 @@ using namespace Js;
             this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->cachedScopeObj, _u("_cachedScopeObj"));
         }
 
+        if (this->GetComputedNameVar() != nullptr)
+        {
+            this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->GetComputedNameVar(), _u("_computedName"));
+        }
+
         if (this->GetHomeObj() != nullptr)
         {
             this->GetScriptContext()->TTDWellKnownInfo->EnqueueNewPathVarAsNeeded(this, this->GetHomeObj(), _u("_homeObj"));

+ 0 - 11
lib/Runtime/Library/ScriptFunction.h

@@ -43,17 +43,6 @@ namespace Js
         }
         virtual Var GetComputedNameVar() const override { return this->computedNameVar; }
         virtual void SetComputedNameVar(Var computedNameVar) override { this->computedNameVar = computedNameVar; }
-
-#if ENABLE_TTD
-        virtual void MarkVisitKindSpecificPtrs(TTD::SnapshotExtractor* extractor)
-        {
-            __super::MarkVisitKindSpecificPtrs(extractor);
-            if (this->computedNameVar != nullptr)
-            {
-                extractor->MarkVisitVar(this->computedNameVar);
-            }
-        }
-#endif
     };
 
     template <class BaseClass>