Răsfoiți Sursa

resolve post-merge conflicts

Michael Holman 9 ani în urmă
părinte
comite
728112862e

+ 1 - 1
lib/Backend/BackwardPass.cpp

@@ -6839,7 +6839,7 @@ BackwardPass::ProcessInlineeStart(IR::Instr* inlineeStart)
     inlineeStart->IterateMetaArgs([&](IR::Instr* metaArg)
     inlineeStart->IterateMetaArgs([&](IR::Instr* metaArg)
     {
     {
         if (i == Js::Constants::InlineeMetaArgIndex_ArgumentsObject &&
         if (i == Js::Constants::InlineeMetaArgIndex_ArgumentsObject &&
-            inlineeStart->m_func->GetJnFunction()->GetUsesArgumentsObject())
+            inlineeStart->m_func->GetJITFunctionBody()->UsesArgumentsObject())
         {
         {
             Assert(!inlineeStart->m_func->GetHasUnoptimizedArgumentsAcccess());
             Assert(!inlineeStart->m_func->GetHasUnoptimizedArgumentsAcccess());
             // Do not remove arguments object meta arg if there is a reference to arguments object
             // Do not remove arguments object meta arg if there is a reference to arguments object

+ 1 - 1
lib/Backend/Func.cpp

@@ -162,7 +162,7 @@ Func::Func(JitArenaAllocator *alloc, JITTimeWorkItem * workItem,
 
 
     if (m_workItem->Type() == JsFunctionType)
     if (m_workItem->Type() == JsFunctionType)
     {
     {
-        if (doStackNestedFunc && GetJITFunctionBody()->GetNestedCount() != 0) &&
+        if (doStackNestedFunc && GetJITFunctionBody()->GetNestedCount() != 0 &&
             this->GetTopFunc()->m_workItem->Type() != JsLoopBodyWorkItemType) // make sure none of the functions inlined in a jitted loop body allocate nested functions on the stack
             this->GetTopFunc()->m_workItem->Type() != JsLoopBodyWorkItemType) // make sure none of the functions inlined in a jitted loop body allocate nested functions on the stack
         {
         {
             Assert(!(this->IsJitInDebugMode() && !GetJITFunctionBody()->IsLibraryCode()));
             Assert(!(this->IsJitInDebugMode() && !GetJITFunctionBody()->IsLibraryCode()));

+ 1 - 1
lib/Backend/Func.h

@@ -691,7 +691,7 @@ public:
     bool                IsStackArgsEnabled()
     bool                IsStackArgsEnabled()
     {
     {
                         Func* curFunc = this;
                         Func* curFunc = this;
-                        bool isStackArgsEnabled = this->m_jnFunction->GetUsesArgumentsObject() && curFunc->GetHasStackArgs();
+                        bool isStackArgsEnabled = GetJITFunctionBody()->UsesArgumentsObject() && curFunc->GetHasStackArgs();
                         Func * topFunc = curFunc->GetTopFunc();
                         Func * topFunc = curFunc->GetTopFunc();
                         if (topFunc != nullptr)
                         if (topFunc != nullptr)
                         {
                         {

+ 13 - 11
lib/Backend/Inline.cpp

@@ -2233,7 +2233,7 @@ IR::Instr* Inline::InlineApply(IR::Instr *callInstr, const FunctionJITTimeInfo *
 
 
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
     TraceInlining(inlinerData, Js::JavascriptLibrary::GetNameForBuiltIn(builtInId),
     TraceInlining(inlinerData, Js::JavascriptLibrary::GetNameForBuiltIn(builtInId),
-        nullptr, 0, this->topFunc->m_workItem->GetFunctionBody(), 0, nullptr, callSiteId, callInstr->m_func->GetTopFunc()->IsLoopBody(), builtInId);
+        nullptr, 0, this->topFunc->GetWorkItem()->GetJITTimeInfo(), 0, nullptr, callSiteId, callInstr->m_func->GetTopFunc()->IsLoopBody(), builtInId);
     char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
     char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 #endif
 #endif
 
 
@@ -3589,7 +3589,7 @@ Inline::InlineScriptFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *co
     // Inlining a function that uses arguments object could potentially hurt perf because we'll have to create arguments object on the 
     // Inlining a function that uses arguments object could potentially hurt perf because we'll have to create arguments object on the 
     // heap for that function (versus otherwise the function will be jitted and have its arguments object creation optimized).
     // heap for that function (versus otherwise the function will be jitted and have its arguments object creation optimized).
     // TODO: Allow arguments object creation to be optimized on a function level instead of an all-or-nothing approach.
     // TODO: Allow arguments object creation to be optimized on a function level instead of an all-or-nothing approach.
-    if (callInstr->m_func->IsLoopBody() && funcBody->GetUsesArgumentsObject())
+    if (callInstr->m_func->IsLoopBody() && funcBody->UsesArgumentsObject())
     {
     {
         return instrNext;
         return instrNext;
     }
     }
@@ -5028,7 +5028,7 @@ Inline::HasArgumentsAccess(IR::Instr * instr, SymID argumentsSymId)
 bool
 bool
 Inline::GetInlineeHasArgumentObject(Func * inlinee)
 Inline::GetInlineeHasArgumentObject(Func * inlinee)
 {
 {
-    if (!inlinee->GetJnFunction()->GetUsesArgumentsObject())
+    if (!inlinee->GetJITFunctionBody()->UsesArgumentsObject())
     {
     {
         // If inlinee has no arguments access return false
         // If inlinee has no arguments access return false
         return false;
         return false;
@@ -5346,11 +5346,12 @@ Inline::Simd128FixLoadStoreInstr(Js::BuiltinFunction builtInId, IR::Instr * call
 
 
     }
     }
 }
 }
+#endif
 
 
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
 // static
 // static
 void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar_t* inlineeName, const wchar_t* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
 void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar_t* inlineeName, const wchar_t* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
-    const FunctionJITTimeInfo* topFunc, uint inlinedByteCodeCount, const FunctionJITTimeInfo *const inlinee, uint callSiteId, uint builtIn)
+    const FunctionJITTimeInfo* topFunc, uint inlinedByteCodeCount, const FunctionJITTimeInfo *const inlinee, uint callSiteId, bool inLoopBody, uint builtIn)
 {
 {
     wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
     wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
     wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
     wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
@@ -5362,7 +5363,8 @@ void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar
         Assert(len > 14);
         Assert(len > 14);
         inlineeName = debugStringBuffer3;
         inlineeName = debugStringBuffer3;
     }
     }
-    INLINE_TESTTRACE(L"INLINING: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\tCallSiteId: %d\n",
+    INLINE_TESTTRACE(L"INLINING %s: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\tCallSiteId: %d\n",
+        inLoopBody ? _u("IN LOOP BODY") : _u(""),
         inlineeName, inlineeFunctionIdandNumberString, inlineeByteCodeCount,
         inlineeName, inlineeFunctionIdandNumberString, inlineeByteCodeCount,
         inliner->GetBody()->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer), inliner->GetBody()->GetByteCodeCount(), inlinedByteCodeCount,
         inliner->GetBody()->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer), inliner->GetBody()->GetByteCodeCount(), inlinedByteCodeCount,
         topFunc->GetBody()->GetDisplayName(),
         topFunc->GetBody()->GetDisplayName(),
@@ -5370,12 +5372,12 @@ void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar
         callSiteId
         callSiteId
     );
     );
 
 
-    INLINE_TRACE(L"INLINING:\n\tInlinee: size: %4d  %s\n\tCaller: size: %4d  %-25s (%s)  InlineCount: %d\tRoot:  size: %4d  %s  (%s) CallSiteId %d\n",
-        inlineeByteCodeCount, inlineeName,
-        inliner->GetBody()->GetByteCodeCount(), inliner->GetBody()->GetDisplayName(),
-        inliner->GetDebugNumberSet(debugStringBuffer), inlinedByteCodeCount,
-        topFunc->GetBody()->GetByteCodeCount(),
-        topFunc->GetBody()->GetDisplayName(), topFunc->GetDebugNumberSet(debugStringBuffer2),
+    INLINE_TRACE(L"INLINING %s: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\tCallSiteId: %d\n",
+        inLoopBody ? _u("IN LOOP BODY") : _u(""),
+        inlineeName, inlineeFunctionIdandNumberString, inlineeByteCodeCount,
+        inliner->GetBody()->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer), inliner->GetBody()->GetByteCodeCount(), inlinedByteCodeCount,
+        topFunc->GetBody()->GetDisplayName(),
+        topFunc->GetDebugNumberSet(debugStringBuffer2), topFunc->GetBody()->GetByteCodeCount(),
         callSiteId
         callSiteId
     );
     );
 
 

+ 1 - 1
lib/Backend/Inline.h

@@ -139,7 +139,7 @@ private:
 
 
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
     static void TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar_t* inlineeName, const wchar_t* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
     static void TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar_t* inlineeName, const wchar_t* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
-        const FunctionJITTimeInfo* topFunc, uint inlinedByteCodeCount, const FunctionJITTimeInfo *const inlinee, uint callSiteId, uint builtIn = -1);
+        const FunctionJITTimeInfo* topFunc, uint inlinedByteCodeCount, const FunctionJITTimeInfo *const inlinee, uint callSiteId, bool inLoopBody, uint builtIn = -1);
 #endif
 #endif
 };
 };
 
 

+ 2 - 0
lib/Backend/InliningDecider.cpp

@@ -628,12 +628,14 @@ bool InliningDecider::GetBuiltInInfoCommon(
 #if defined(_M_X64) || defined(_M_IX86)
 #if defined(_M_X64) || defined(_M_IX86)
     default:
     default:
     {
     {
+#if 0 // TODO OOP JIT, inline SIMD
         // inline only if simdjs and simd128 type-spec is enabled.
         // inline only if simdjs and simd128 type-spec is enabled.
         if (scriptContext->GetConfig()->IsSimdjsEnabled() && SIMD128_TYPE_SPEC_FLAG)
         if (scriptContext->GetConfig()->IsSimdjsEnabled() && SIMD128_TYPE_SPEC_FLAG)
         {
         {
             *inlineCandidateOpCode = scriptContext->GetThreadContext()->GetSimdOpcodeFromFuncInfo(funcInfo);
             *inlineCandidateOpCode = scriptContext->GetThreadContext()->GetSimdOpcodeFromFuncInfo(funcInfo);
         }
         }
         else
         else
+#endif
         {
         {
             return false;
             return false;
         }
         }

+ 0 - 1
lib/Backend/InliningHeuristics.cpp

@@ -187,4 +187,3 @@ bool InliningHeuristics::BackendInlineIntoInliner(const FunctionJITTimeInfo * in
     }
     }
     return true;
     return true;
 }
 }
-    if (PHASE_FORCE(Js::InlinePhase, this->topFunc) || bytecodeInlinedCount <= (uint)threshold.inlineCountMax)

+ 1 - 1
lib/Backend/InliningHeuristics.h

@@ -18,7 +18,7 @@ struct InliningThreshold
     int maxNumberOfInlineesWithLoop;
     int maxNumberOfInlineesWithLoop;
     int constantArgumentInlineThreshold;
     int constantArgumentInlineThreshold;
 
 
-    InliningThreshold(Js::FunctionBody * topFunc, bool aggressive = false);
+    InliningThreshold(uint nonLoadByteCodeCount, bool forLoopBody, bool aggressive = false);
     void SetHeuristics();
     void SetHeuristics();
     void SetAggressiveHeuristics();
     void SetAggressiveHeuristics();
     void Reset();
     void Reset();

+ 7 - 0
lib/Backend/JITTimeFunctionBody.cpp

@@ -162,6 +162,7 @@ JITTimeFunctionBody::InitializeJITFunctionData(
     jitBody->hasNestedLoop = functionBody->GetHasNestedLoop();
     jitBody->hasNestedLoop = functionBody->GetHasNestedLoop();
     jitBody->isParamAndBodyScopeMerged = functionBody->IsParamAndBodyScopeMerged();
     jitBody->isParamAndBodyScopeMerged = functionBody->IsParamAndBodyScopeMerged();
     jitBody->paramClosureReg = functionBody->GetParamClosureRegister();
     jitBody->paramClosureReg = functionBody->GetParamClosureRegister();
+    jitBody->usesArgumentsObject = functionBody->GetUsesArgumentsObject();
     
     
     //CompileAssert(sizeof(PropertyIdArrayIDL) == sizeof(Js::PropertyIdArray));
     //CompileAssert(sizeof(PropertyIdArrayIDL) == sizeof(Js::PropertyIdArray));
     jitBody->formalsPropIdArray = (PropertyIdArrayIDL*)functionBody->GetFormalsPropIdArray(false);
     jitBody->formalsPropIdArray = (PropertyIdArrayIDL*)functionBody->GetFormalsPropIdArray(false);
@@ -554,6 +555,12 @@ JITTimeFunctionBody::HasNestedLoop() const
     return m_bodyData.hasNestedLoop != FALSE;
     return m_bodyData.hasNestedLoop != FALSE;
 }
 }
 
 
+bool
+JITTimeFunctionBody::UsesArgumentsObject() const
+{
+    return m_bodyData.usesArgumentsObject != FALSE;
+}
+
 bool
 bool
 JITTimeFunctionBody::IsParamAndBodyScopeMerged() const
 JITTimeFunctionBody::IsParamAndBodyScopeMerged() const
 {
 {

+ 1 - 0
lib/Backend/JITTimeFunctionBody.h

@@ -88,6 +88,7 @@ public:
     bool HasLoops() const;
     bool HasLoops() const;
     bool HasNonBuiltInCallee() const;
     bool HasNonBuiltInCallee() const;
     bool HasNestedLoop() const;
     bool HasNestedLoop() const;
+    bool UsesArgumentsObject() const;
     bool IsParamAndBodyScopeMerged() const;
     bool IsParamAndBodyScopeMerged() const;
     bool CanInlineRecursively(uint depth, bool tryAggressive = true) const;
     bool CanInlineRecursively(uint depth, bool tryAggressive = true) const;
     bool NeedScopeObjectForArguments(bool hasNonSimpleParams) const;
     bool NeedScopeObjectForArguments(bool hasNonSimpleParams) const;

+ 1 - 0
lib/JITIDL/ChakraJIT.idl

@@ -373,6 +373,7 @@ typedef struct FunctionBodyDataIDL
     boolean hasNonBuiltInCallee;
     boolean hasNonBuiltInCallee;
     boolean isParamAndBodyScopeMerged;
     boolean isParamAndBodyScopeMerged;
     boolean hasFinally;
     boolean hasFinally;
+    boolean usesArgumentsObject;
 
 
     unsigned short envDepth;
     unsigned short envDepth;
     unsigned short inParamCount;
     unsigned short inParamCount;