Browse Source

Fix redeferral for deserialized DeferDeserializeFunctionInfo functions

When DeferDeserializeFunctionInfo transitions into a FunctionBody during Deserialize, the deferredPrototypeType and undeferredFunctionType from FunctionProxy are not copied into the FunctionBody because copying them is only done in ParseableFunctionInfo::Copy (DeferDeserializeFunctionInfo does not call this). If the FunctionBody is then redeferred, we'll fail to reset the type since it wasn't saved.

Fix is to copy these two fields in FunctionProxy::Copy which is called by DeferDeserializeFunctionInfo::Deserialize.
Taylor Woll 7 years ago
parent
commit
cf6ed6f452
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lib/Runtime/Base/FunctionBody.cpp

+ 5 - 2
lib/Runtime/Base/FunctionBody.cpp

@@ -1433,6 +1433,11 @@ namespace Js
         {
             other->SetIsJsBuiltInCode();
         }
+
+#define CopyDeferParseField(field) other->field = this->field;
+        CopyDeferParseField(deferredPrototypeType);
+        CopyDeferParseField(undeferredFunctionType);
+#undef CopyDeferParseField
     }
 
     void ParseableFunctionInfo::Copy(ParseableFunctionInfo * other)
@@ -1466,8 +1471,6 @@ namespace Js
         other->SetCachedSourceStringWeakRef(this->GetCachedSourceStringWeakRef());
         CopyDeferParseField(m_isAsmjsMode);
         CopyDeferParseField(m_isAsmJsFunction);
-        CopyDeferParseField(deferredPrototypeType);
-        CopyDeferParseField(undeferredFunctionType);
 
         other->SetFunctionObjectTypeList(this->GetFunctionObjectTypeList());