Przeglądaj źródła

A pass over initialization of Arena-allocated classes

PREfast raised warnings on a number of classes about members lacking
initialization before the constructor, and in many cases after it. A
comparison between that list and the list of classes that we make in
arena memory (where we often don't zero) gave the set addressed here
in the associated files.
Derek Morris 8 lat temu
rodzic
commit
eca08f1ab9

+ 2 - 0
lib/Backend/FlowGraph.h

@@ -140,7 +140,9 @@ public:
         loopList(nullptr),
         catchLabelStack(nullptr),
         finallyLabelStack(nullptr),
+        leaveNullLabelStack(nullptr),
         regToFinallyEndMap(nullptr),
+        leaveNullLabelToFinallyLabelMap(nullptr),
         hasBackwardPassInfo(false),
         hasLoop(false),
         implicitCallFlags(Js::ImplicitCall_HasNoInfo)

+ 3 - 2
lib/Backend/Func.h

@@ -28,7 +28,8 @@ struct Cloner
         lowerer(lowerer),
         instrFirst(nullptr),
         instrLast(nullptr),
-        fRetargetClonedBranch(FALSE)
+        fRetargetClonedBranch(FALSE),
+        clonedInstrGetOrigArgSlotSym(false)
     {
     }
 
@@ -48,13 +49,13 @@ struct Cloner
     void Finish();
     void RetargetClonedBranches();
 
+    JitArenaAllocator *alloc;
     HashTable<StackSym*> *symMap;
     HashTable<IR::LabelInstr*> *labelMap;
     Lowerer * lowerer;
     IR::Instr * instrFirst;
     IR::Instr * instrLast;
     BOOL fRetargetClonedBranch;
-    JitArenaAllocator *alloc;
     bool clonedInstrGetOrigArgSlotSym;
 };
 

+ 2 - 2
lib/Backend/GlobOpt.h

@@ -169,7 +169,7 @@ private:
 
 public:
     PathDependentInfo(const PathDependentRelationship relationship, Value *const leftValue, Value *const rightValue)
-        : relationship(relationship), leftValue(leftValue), rightValue(rightValue)
+        : leftValue(leftValue), rightValue(rightValue), rightConstantValue(0), relationship(relationship)
     {
         Assert(leftValue);
         Assert(rightValue);
@@ -180,7 +180,7 @@ public:
         Value *const leftValue,
         Value *const rightValue,
         const int32 rightConstantValue)
-        : relationship(relationship), leftValue(leftValue), rightValue(rightValue), rightConstantValue(rightConstantValue)
+        : leftValue(leftValue), rightValue(rightValue), rightConstantValue(rightConstantValue), relationship(relationship)
     {
         Assert(leftValue);
     }

+ 5 - 2
lib/Backend/IR.h

@@ -42,7 +42,7 @@ class BranchJumpTableWrapper
 {
 public:
 
-    BranchJumpTableWrapper(uint tableSize) : defaultTarget(nullptr), labelInstr(nullptr), tableSize(tableSize)
+    BranchJumpTableWrapper(uint tableSize) : jmpTable(nullptr), defaultTarget(nullptr), labelInstr(nullptr), tableSize(tableSize)
     {
     }
 
@@ -832,7 +832,10 @@ public:
     IntConstType m_lastCaseValue;
 
     MultiBranchInstr() :
-        m_branchTargets(nullptr)
+        m_branchTargets(nullptr),
+        m_kind(IntJumpTable),
+        m_baseCaseValue(0),
+        m_lastCaseValue(0)
     {
 #if DBG
         m_isMultiBranch = true;

+ 36 - 9
lib/Backend/Lifetime.h

@@ -9,16 +9,43 @@ class Lifetime
 {
 public:
 
-    Lifetime(JitArenaAllocator * alloc, StackSym *sym, RegNum reg, uint32 start, uint32 end, Func *func)
-        : sym(sym), reg(reg), start(start), end(end), previousDefBlockNumber(0), defList(alloc),
-        useList(alloc), lastUseLabel(NULL), region(NULL), isSpilled(false), useCount(0), useCountAdjust(0), allDefsCost(0), isLiveAcrossCalls(false),
-        isLiveAcrossUserCalls(false), isDeadStore(true), isOpHelperSpilled(false), cantOpHelperSpill(false), isOpHelperSpillAsArg(false),
-        isFloat(0), cantSpill(false), dontAllocate(false), isSecondChanceAllocated(false), isCheapSpill(false), spillStackSlot(NULL),
-          totalOpHelperLengthByEnd(0), needsStoreCompensation(false), alloc(alloc), regionUseCount(NULL), regionUseCountAdjust(NULL),
-          cantStackPack(false)
+    Lifetime(JitArenaAllocator * alloc, StackSym *sym, RegNum reg, uint32 start, uint32 end)
+        :
+        sym(sym),
+        regionUseCount(nullptr),
+        regionUseCountAdjust(nullptr),
+        defList(alloc),
+        useList(alloc),
+        lastUseLabel(nullptr),
+        region(nullptr),
+        spillStackSlot(nullptr),
+        alloc(alloc),
+        intUsageBv(0),
+        regPreference(0),
+        start(start),
+        end(end),
+        previousDefBlockNumber(0),
+        useCount(0),
+        useCountAdjust(0),
+        allDefsCost(0),
+        lastAllocationStart(0),
+        reg(reg),
+        totalOpHelperLengthByEnd(0),
+        isSpilled(false),
+        isLiveAcrossCalls(false),
+        isLiveAcrossUserCalls(false),
+        isDeadStore(true),
+        isOpHelperSpilled(false),
+        isOpHelperSpillAsArg(false),
+        cantOpHelperSpill(false),
+        cantSpill(false),
+        dontAllocate(false),
+        isSecondChanceAllocated(false),
+        isCheapSpill(false),
+        needsStoreCompensation(false),
+        cantStackPack(false),
+        isFloat(false)
     {
-        intUsageBv.ClearAll();
-        regPreference.ClearAll();
     }
 
 public:

+ 1 - 1
lib/Backend/SccLiveness.cpp

@@ -722,7 +722,7 @@ Lifetime *
 SCCLiveness::InsertLifetime(StackSym *stackSym, RegNum reg, IR::Instr *const currentInstr)
 {
     const uint start = currentInstr->GetNumber(), end = start;
-    Lifetime * newLlifetime = JitAnew(tempAlloc, Lifetime, tempAlloc, stackSym, reg, start, end, this->func);
+    Lifetime * newLlifetime = JitAnew(tempAlloc, Lifetime, tempAlloc, stackSym, reg, start, end);
     newLlifetime->totalOpHelperLengthByEnd = this->totalOpHelperFullVisitedLength + CurrentOpHelperVisitedLength(currentInstr);
 
     // Find insertion point

+ 7 - 3
lib/Backend/SymTable.h

@@ -24,10 +24,14 @@ public:
     PropertyEquivBvMap *m_propertyEquivBvMap;
 
 public:
-    SymTable() : m_currentID(0), m_func(nullptr), m_IDAdjustment(0)
+    SymTable() :
+        m_table{ nullptr },
+        m_implicitParams{ nullptr },
+        m_propertyMap(nullptr),
+        m_func(nullptr),
+        m_currentID(0),
+        m_IDAdjustment(0)
     {
-        memset(m_table, 0, sizeof(m_table));
-        memset(m_implicitParams, 0, sizeof(m_implicitParams));
     }
 
 

+ 4 - 4
lib/Backend/ValueInfo.h

@@ -35,7 +35,7 @@ private:
 
 protected:
     ValueInfo(const ValueType type, const ValueStructureKind structureKind)
-        : ValueType(type), structureKind(structureKind)
+        : ValueType(type), structureKind(structureKind), symStore(nullptr)
     {
         // We can only prove that the representation is a tagged int on a ToVar. Currently, we cannot have more than one value
         // info per value number in a block, so a value info specifying tagged int representation cannot be created for a
@@ -43,13 +43,13 @@ protected:
         // representation. Currently, the tagged int representation info can only be carried on the dst opnd of ToVar, and can't
         // even be propagated forward.
         Assert(!type.IsTaggedInt());
-
-        SetSymStore(nullptr);
     }
 
 private:
     ValueInfo(const ValueInfo &other, const bool)
-        : ValueType(other), structureKind(ValueStructureKind::Generic) // uses generic structure kind, as opposed to copying the structure kind
+        : ValueType(other),
+        structureKind(ValueStructureKind::Generic), // uses generic structure kind, as opposed to copying the structure kind
+        symStore(nullptr) // Will be immediately overridden
     {
         SetSymStore(other.GetSymStore());
     }

+ 86 - 64
lib/Parser/Parse.cpp

@@ -56,10 +56,10 @@ struct StmtNest
     };
     StmtNest *pstmtOuter;           // Enclosing statement.
 
-    OpCode GetNop() const 
-    { 
+    OpCode GetNop() const
+    {
         AnalysisAssert(isDeferred || pnodeStmt != nullptr);
-        return isDeferred ? op : pnodeStmt->nop; 
+        return isDeferred ? op : pnodeStmt->nop;
     }
 };
 
@@ -78,63 +78,85 @@ Parser::Parser(Js::ScriptContext* scriptContext, BOOL strictMode, PageAllocator
 Parser::Parser(Js::ScriptContext* scriptContext, BOOL strictMode, PageAllocator *alloc, bool isBackground)
 #endif
     : m_nodeAllocator(_u("Parser"), alloc ? alloc : scriptContext->GetThreadContext()->GetPageAllocator(), Parser::OutOfMemory),
+    m_cactIdentToNodeLookup(0),
+    m_grfscr(fscrNil),
+    m_length(0),
+    m_originalLength(0),
+    m_nextFunctionId(nullptr),
+    m_sourceContextInfo(nullptr),
+#if ENABLE_BACKGROUND_PARSING
+    m_isInBackground(isBackground),
+    m_hasParallelJob(false),
+    m_doingFastScan(false),
+#endif
+    m_nextBlockId(0),
     // use the GuestArena directly for keeping the RegexPattern* alive during byte code generation
-    m_registeredRegexPatterns(scriptContext->GetGuestArena())
+    m_registeredRegexPatterns(scriptContext->GetGuestArena()),
+
+    m_scriptContext(scriptContext),
+    m_phtbl(nullptr),
+
+    m_token(), // should initialize to 0/nullptrs
+    m_pscan(nullptr),
+
+    m_currentNodeNonLambdaFunc(nullptr),
+    m_currentNodeNonLambdaDeferredFunc(nullptr),
+    m_currentNodeFunc(nullptr),
+    m_currentNodeDeferredFunc(nullptr),
+    m_currentNodeProg(nullptr),
+    m_currDeferredStub(nullptr),
+    m_prevSiblingDeferredStub(nullptr),
+    m_pCurrentAstSize(nullptr),
+    m_ppnodeScope(nullptr),
+    m_ppnodeExprScope(nullptr),
+    m_ppnodeVar(nullptr),
+    m_inDeferredNestedFunc(false),
+    m_reparsingLambdaParams(false),
+    m_disallowImportExportStmt(false),
+    m_isInParsingArgList(false),
+    m_hasDestructuringPattern(false),
+    m_hasDeferredShorthandInitError(false),
+    m_pnestedCount(nullptr),
+
+    wellKnownPropertyPids(), // should initialize to nullptrs
+    m_sourceLim(0),
+    m_functionBody(nullptr),
+    m_parseType(ParseType_Upfront),
+
+    m_arrayDepth(0),
+    m_funcInArrayDepth(0),
+    m_funcInArray(0),
+    m_scopeCountNoAst(0),
+
+    m_parsingSuperRestrictionState(ParsingSuperRestrictionState_SuperDisallowed),
+
+    m_funcParenExprDepth(0),
+    m_deferEllipsisError(false),
+    m_deferEllipsisErrorLoc(), // calls default initializer
+
+    m_tryCatchOrFinallyDepth(0),
+
+    m_pstmtCur(nullptr),
+    m_currentBlockInfo(nullptr),
+    m_currentScope(nullptr),
+
+    currBackgroundParseItem(nullptr),
+    backgroundParseItems(nullptr),
+    fastScannedRegExpNodes(nullptr),
+
+    m_currentDynamicBlock(nullptr),
+
+    m_UsesArgumentsAtGlobal(false),
+
+    m_fUseStrictMode(strictMode),
+    m_InAsmMode(false),
+    m_deferAsmJs(true),
+    m_fExpectExternalSource(FALSE),
+    m_deferringAST(FALSE),
+    m_stoppedDeferredParse(FALSE)
 {
     AssertMsg(size == sizeof(Parser), "verify conditionals affecting the size of Parser agree");
     Assert(scriptContext != nullptr);
-    m_phtbl = nullptr;
-    m_pscan = nullptr;
-    m_deferringAST = FALSE;
-    m_stoppedDeferredParse = FALSE;
-#if ENABLE_BACKGROUND_PARSING
-    m_isInBackground = isBackground;
-    m_hasParallelJob = false;
-    m_doingFastScan = false;
-#endif
-    m_isInParsingArgList = false;
-    m_hasDestructuringPattern = false;
-    m_scriptContext = scriptContext;
-    m_pCurrentAstSize = nullptr;
-    m_arrayDepth = 0;
-    m_funcInArrayDepth = 0;
-    m_funcParenExprDepth = 0;
-    m_funcInArray = 0;
-    m_tryCatchOrFinallyDepth = 0;
-    m_UsesArgumentsAtGlobal = false;
-    m_currentNodeFunc = nullptr;
-    m_currentNodeDeferredFunc = nullptr;
-    m_currentNodeNonLambdaFunc = nullptr;
-    m_currentNodeNonLambdaDeferredFunc = nullptr;
-    m_currentNodeProg = nullptr;
-    m_currDeferredStub = nullptr;
-    m_prevSiblingDeferredStub = nullptr;
-    m_pstmtCur = nullptr;
-    m_currentBlockInfo = nullptr;
-    m_currentScope = nullptr;
-    m_currentDynamicBlock = nullptr;
-    m_grfscr = fscrNil;
-    m_length = 0;
-    m_originalLength = 0;
-    m_nextFunctionId = nullptr;
-    m_reparsingLambdaParams = false;
-    currBackgroundParseItem = nullptr;
-    backgroundParseItems = nullptr;
-    fastScannedRegExpNodes = nullptr;
-
-    m_fUseStrictMode = strictMode;
-    m_InAsmMode = false;
-    m_deferAsmJs = true;
-    m_scopeCountNoAst = 0;
-    m_fExpectExternalSource = 0;
-
-    m_parseType = ParseType_Upfront;
-
-    m_deferEllipsisError = false;
-    m_hasDeferredShorthandInitError = false;
-    m_parsingSuperRestrictionState = ParsingSuperRestrictionState_SuperDisallowed;
-
-    m_disallowImportExportStmt = false;
 }
 
 Parser::~Parser(void)
@@ -5429,7 +5451,7 @@ bool Parser::ParseFncDeclHelper(ParseNodePtr pnodeFnc, LPCOLESTR pNameHint, usho
         }
 
         // These are heuristic conditions that prohibit upfront deferral but not redeferral.
-        isTopLevelDeferredFunc = isTopLevelDeferredFunc && !isDeferredFnc && 
+        isTopLevelDeferredFunc = isTopLevelDeferredFunc && !isDeferredFnc &&
             (!isLikelyIIFE || !topLevelStmt || PHASE_FORCE_RAW(Js::DeferParsePhase, m_sourceContextInfo->sourceContextId, pnodeFnc->sxFnc.functionId));
 
 #if ENABLE_BACKGROUND_PARSING
@@ -6559,7 +6581,7 @@ bool Parser::ParseFncNames(ParseNodePtr pnodeFnc, ParseNodePtr pnodeFncParent, u
         {
             // Multiple names. Turn the source into an IdentPtr.
             pnodeFnc->sxFnc.pid = m_phtbl->PidHashNameLen(
-                m_pscan->PchBase() + ichMinNames, 
+                m_pscan->PchBase() + ichMinNames,
                 m_pscan->AdjustedLast(),
                 ichLimNames - ichMinNames);
         }
@@ -7249,7 +7271,7 @@ void Parser::FinishFncNode(ParseNodePtr pnodeFnc)
     else
     {
         m_pscan->SetCurrentCharacter(pnodeFnc->ichMin, pnodeFnc->sxFnc.lineNumber);
-        
+
         if (fMethod)
         {
             // Method. Skip identifier name, computed property name, "async", "get", "set", and '*' or '(' characters.
@@ -8866,7 +8888,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
 
             ParseDestructuredLiteralWithScopeSave(tkLCurly, false/*isDecl*/, false /*topLevel*/, DIC_ShouldNotParseInitializer);
 
-            // Restore the Block ID at the end of the reparsing so it matches the one at the end of the first pass. We need to do this 
+            // Restore the Block ID at the end of the reparsing so it matches the one at the end of the first pass. We need to do this
             // because we don't parse initializers during reparse and there may be additional blocks (e.g. a class declaration)
             // in the initializers that will cause the next Block ID at the end of the reparsing to be different.
             m_nextBlockId = saveNextBlockId;
@@ -8976,9 +8998,9 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
                     }
 
                     // Assignment stmt of the form "this.<id> = <expr>"
-                    if (nop == knopAsg 
-                        && pnode->nop == knopDot 
-                        && pnode->sxBin.pnode1->nop == knopName 
+                    if (nop == knopAsg
+                        && pnode->nop == knopDot
+                        && pnode->sxBin.pnode1->nop == knopName
                         && pnode->sxBin.pnode1->sxVar.pid == wellKnownPropertyPids._this
                         && pnode->sxBin.pnode2->nop == knopName)
                     {
@@ -12761,7 +12783,7 @@ IdentPtr Parser::ParseSuper(bool fAllowCall)
         // Anything else is an error
         Error(ERRInvalidSuper);
     }
-    
+
     return superPid;
 }
 

+ 4 - 4
lib/Runtime/ByteCode/ByteBlock.h

@@ -11,10 +11,10 @@ namespace Js
         DECLARE_OBJECT(ByteBlock)
 
     private:
-        Field(uint) m_contentSize;     // Length of block, in bytes
+        Field(uint) m_contentSize = 0;     // Length of block, in bytes
 
         __declspec(align(4))    // Align the buffer to sizeof(uint32) to improve GetHashCode() perf.
-            Field(byte*) m_content;    // The block's content
+            Field(byte*) m_content = nullptr;    // The block's content
 
         static ByteBlock* New(Recycler* alloc, const byte * initialContent, int initialContentSize, ScriptContext * requestContext);
 
@@ -22,14 +22,14 @@ namespace Js
         ByteBlock(uint size, byte * content)
             : m_contentSize(size), m_content(content)
         { }
-        ByteBlock(uint size, Recycler *alloc) : m_contentSize(size)
+        ByteBlock(uint size, Recycler *alloc) : m_contentSize(size), m_content(nullptr)
         {
             // The New function below will copy over a buffer into this so
             // we don't need to zero it out
             m_content = RecyclerNewArrayLeaf(alloc, byte, size);
         }
 
-        ByteBlock(uint size, ArenaAllocator* alloc) : m_contentSize(size)
+        ByteBlock(uint size, ArenaAllocator* alloc) : m_contentSize(size), m_content(nullptr)
         {
             m_content = AnewArray(alloc, byte, size);
         }

+ 27 - 2
lib/Runtime/ByteCode/ByteCodeSerializer.cpp

@@ -2309,10 +2309,35 @@ public:
     bool const isLibraryCode;
 public:
     ByteCodeBufferReader(ScriptContext * scriptContext, byte * raw, bool isLibraryCode, int builtInPropertyCount)
-        : scriptContext(scriptContext), raw(raw), utf8SourceInfo(nullptr), isLibraryCode(isLibraryCode),
+        : scriptContext(scriptContext),
+        raw(raw),
+        magic(0),
+        totalSize(0),
+        fileVersionScheme(0),
+        V1(0),
+        V2(0),
+        V3(0),
+        V4(0),
+        architecture(0),
         expectedFunctionBodySize(sizeof(unaligned FunctionBody)),
         expectedBuildInPropertyCount(builtInPropertyCount),
-        expectedOpCodeCount((int)OpCode::Count)
+        expectedOpCodeCount((int)OpCode::Count),
+        firstFunctionId(0),
+        functionCount(0),
+        string16s(nullptr),
+        string16Count(0),
+        string16IndexTable(nullptr),
+        string16Table(nullptr),
+        lineInfoCacheCount(0),
+        lineInfoCaches(nullptr),
+        lineCharacterOffsetCacheBuffer(nullptr),
+        lineByteOffsetCacheBuffer(nullptr),
+        functions(nullptr),
+        sourceSize(0),
+        sourceCharLength(0),
+        utf8SourceInfo(nullptr),
+        sourceIndex(0),
+        isLibraryCode(isLibraryCode)
     {
         if (isLibraryCode)
         {

+ 42 - 32
lib/Runtime/ByteCode/FuncInfo.cpp

@@ -12,25 +12,36 @@ FuncInfo::FuncInfo(
     Scope *bodyScope,
     ParseNode *pnode,
     Js::ParseableFunctionInfo* byteCodeFunction)
-    : alloc(alloc),
+    :
+    inlineCacheCount(0),
+    rootObjectLoadInlineCacheCount(0),
+    rootObjectLoadMethodInlineCacheCount(0),
+    rootObjectStoreInlineCacheCount(0),
+    isInstInlineCacheCount(0),
+    referencedPropertyIdCount(0),
+    currentChildFunction(nullptr),
+    currentChildScope(nullptr),
+    capturedSyms(nullptr),
+    capturedSymMap(nullptr),
+    nextForInLoopLevel(0),
+    maxForInLoopLevel(0),
+    alloc(alloc),
     varRegsCount(0),
     constRegsCount(InitialConstRegsCount),
     inArgsCount(0),
-    innerScopeCount(0),
-    currentInnerScopeIndex((uint)-1),
-    firstTmpReg(Js::Constants::NoRegister),
-    curTmpReg(Js::Constants::NoRegister),
     outArgsMaxDepth(0),
     outArgsCurrentExpr(0),
+    innerScopeCount(0),
+    currentInnerScopeIndex((uint)-1),
 #if DBG
     outArgsDepth(0),
 #endif
     name(name),
-    thisConstantRegister(Js::Constants::NoRegister),
     nullConstantRegister(Js::Constants::NoRegister),
     undefinedConstantRegister(Js::Constants::NoRegister),
     trueConstantRegister(Js::Constants::NoRegister),
     falseConstantRegister(Js::Constants::NoRegister),
+    thisConstantRegister(Js::Constants::NoRegister),
     envRegister(Js::Constants::NoRegister),
     frameObjRegister(Js::Constants::NoRegister),
     frameSlotsRegister(Js::Constants::NoRegister),
@@ -39,14 +50,11 @@ FuncInfo::FuncInfo(
     funcObjRegister(Js::Constants::NoRegister),
     localClosureReg(Js::Constants::NoRegister),
     yieldRegister(Js::Constants::NoRegister),
-    paramScope(paramScope),
-    bodyScope(bodyScope),
-    funcExprScope(nullptr),
-    root(pnode),
-    capturedSyms(nullptr),
-    capturedSymMap(nullptr),
-    currentChildFunction(nullptr),
-    currentChildScope(nullptr),
+    firstTmpReg(Js::Constants::NoRegister),
+    curTmpReg(Js::Constants::NoRegister),
+    argsPlaceHolderSlotCount(0),
+    originalAttributes(Js::FunctionInfo::Attributes::None),
+
     callsEval(false),
     childCallsEval(false),
     hasArguments(false),
@@ -65,32 +73,34 @@ FuncInfo::FuncInfo(
 #if DBG
     isReused(false),
 #endif
-    staticFuncId(-1),
+
+    constantToRegister(alloc, 17),
+    stringToRegister(alloc, 17),
+    doubleConstantToRegister(alloc, 17),
+    stringTemplateCallsiteRegisterMap(alloc, 17),
+
+    paramScope(paramScope),
+    bodyScope(bodyScope),
+    funcExprScope(nullptr),
+    root(pnode),
+    byteCodeFunction(byteCodeFunction),
+    targetStatements(alloc),
+    singleExit(0),
+    rootObjectLoadInlineCacheMap(nullptr),
+    rootObjectLoadMethodInlineCacheMap(nullptr),
+    rootObjectStoreInlineCacheMap(nullptr),
     inlineCacheMap(nullptr),
+    referencedPropertyIdToMapIndex(nullptr),
+    valueOfStoreCacheIds(),
+    toStringStoreCacheIds(),
     slotProfileIdMap(alloc),
-    argsPlaceHolderSlotCount(0),
-    inlineCacheCount(0),
-    rootObjectLoadInlineCacheCount(0),
-    rootObjectLoadMethodInlineCacheCount(0),
-    rootObjectStoreInlineCacheCount(0),
-    isInstInlineCacheCount(0),
-    referencedPropertyIdCount(0),
     argumentsSymbol(nullptr),
     thisSymbol(nullptr),
     newTargetSymbol(nullptr),
     superSymbol(nullptr),
     superConstructorSymbol(nullptr),
-    nonUserNonTempRegistersToInitialize(alloc),
-    constantToRegister(alloc, 17),
-    stringToRegister(alloc, 17),
-    doubleConstantToRegister(alloc, 17),
-    stringTemplateCallsiteRegisterMap(alloc, 17),
-    targetStatements(alloc),
-    nextForInLoopLevel(0),
-    maxForInLoopLevel(0),
-    originalAttributes(Js::FunctionInfo::Attributes::None)
+    nonUserNonTempRegistersToInitialize(alloc)
 {
-    this->byteCodeFunction = byteCodeFunction;
     if (bodyScope != nullptr)
     {
         bodyScope->SetFunc(this);

+ 0 - 3
lib/Runtime/ByteCode/FuncInfo.h

@@ -117,9 +117,6 @@ public:
     Js::RegSlot firstTmpReg;
     Js::RegSlot curTmpReg;
     int argsPlaceHolderSlotCount;   // count of place holder slots for same name args and destructuring patterns
-    Js::RegSlot firstThunkArgReg;
-    short thunkArgCount;
-    short staticFuncId;
     Js::FunctionInfo::Attributes originalAttributes;
 
     uint callsEval : 1;

+ 13 - 7
lib/Runtime/ByteCode/Symbol.h

@@ -62,28 +62,31 @@ private:
 public:
     Symbol(SymbolName const& name, ParseNode *decl, SymbolType symbolType) :
         name(name),
+        pid(nullptr),
         decl(decl),
-        next(nullptr),
+        scope(nullptr),
+        position(Js::Constants::NoProperty),
         location(Js::Constants::NoRegister),
+        scopeSlot(Js::Constants::NoProperty),
+        moduleIndex(Js::Constants::NoProperty),
+        next(nullptr),
+        symbolType(symbolType), // will get set to the same value in SetSymbolType
+        defCount(0),
         needDeclaration(false),
         isBlockVar(false),
         isConst(false),
         isGlobal(false),
+        isEval(false), // will get properly set in constructor body
         hasNonLocalReference(false),
         isFuncExpr(false),
         isCatch(false),
         hasInit(false),
         isUsed(false),
-        defCount(0),
-        position(Js::Constants::NoProperty),
-        scopeSlot(Js::Constants::NoProperty),
         isGlobalCatch(false),
         isCommittedToSlot(false),
         hasNonCommittedReference(false),
         hasVisitedCapturingFunc(false),
         isTrackedForDebugger(false),
-        isNonSimpleParameter(false),
-        assignmentState(NotAssigned),
         isModuleExportStorage(false),
         isModuleImport(false),
         isUsedInLdElem(false),
@@ -92,7 +95,10 @@ public:
         isSuper(false),
         isSuperConstructor(false),
         needsScopeObject(false),
-        moduleIndex(Js::Constants::NoProperty)
+        hasFuncAssignment(false), // will get reset by SetSymbolType
+        hasMaybeEscapedUse(false), // will get reset by SetSymbolType
+        isNonSimpleParameter(false),
+        assignmentState(NotAssigned)
     {
         SetSymbolType(symbolType);
 

+ 5 - 1
lib/Runtime/Debug/DiagObjectModel.cpp

@@ -960,7 +960,11 @@ namespace Js
     // DiagScopeVariablesWalker
 
     DiagScopeVariablesWalker::DiagScopeVariablesWalker(DiagStackFrame* _pFrame, Var _instance, IDiagObjectModelWalkerBase* innerWalker)
-        : VariableWalkerBase(_pFrame, _instance, UIGroupType_InnerScope, /* allowLexicalThis */ false)
+        : VariableWalkerBase(_pFrame, _instance, UIGroupType_InnerScope, /* allowLexicalThis */ false),
+        pDiagScopeObjects(nullptr),
+        diagScopeVarCount(0),
+        scopeIsInitialized(false), // false until end of method
+        enumWithScopeAlso(false)
     {
         ScriptContext * scriptContext = _pFrame->GetScriptContext();
         ArenaAllocator *arena = GetArenaFromContext(scriptContext);

+ 1 - 1
lib/Runtime/Library/SingleCharString.h

@@ -21,7 +21,7 @@ namespace Js
 
     private:
         SingleCharString(char16 ch, StaticType * type);
-        Field(char16) m_buff[2]; // the 2nd is always NULL so that GetSz works
+        Field(char16) m_buff[2] = { 0 }; // the 2nd is always NULL so that GetSz works
     };
 
 } // namespace Js

+ 10 - 5
lib/WasmReader/WasmBinaryReader.cpp

@@ -72,13 +72,18 @@ bool FunctionIndexTypes::CanBeExported(FunctionIndexTypes::Type funcType)
 }
 
 WasmBinaryReader::WasmBinaryReader(ArenaAllocator* alloc, Js::WebAssemblyModule* module, const byte* source, size_t length) :
-    m_module(module),
-    m_curFuncEnd(nullptr),
     m_alloc(alloc),
-    m_readerState(READER_STATE_UNKNOWN)
+    m_start(source),
+    m_end(source + length),
+    m_pc(source),
+    m_curFuncEnd(nullptr),
+    m_currentSection(),
+    m_readerState(READER_STATE_UNKNOWN),
+    m_module(module)
+#if DBG_DUMP
+    , m_ops(nullptr)
+#endif
 {
-    m_start = m_pc = source;
-    m_end = source + length;
     m_currentSection.code = bSectLimit;
 #if DBG_DUMP
     m_ops = Anew(m_alloc, OpSet, m_alloc);

+ 0 - 1
lib/WasmReader/WasmBinaryReader.h

@@ -117,7 +117,6 @@ namespace Wasm
         Wasm::WasmTypes::WasmType ReadWasmType(uint32& length);
 
         ArenaAllocator* m_alloc;
-        uint32 m_funcNumber;
         const byte* m_start, *m_end, *m_pc, *m_curFuncEnd;
         SectionHeader m_currentSection;
         ReaderState m_funcState;   // func AST level