Skip to content

Commit d923661

Browse files
committed
Add option to delay full JIT small functions
1 parent 913b37a commit d923661

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

lib/Common/ConfigFlagsList.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ PHASE(All)
409409
#define DEFAULT_CONFIG_DumpCommentsFromReferencedFiles (false)
410410
#define DEFAULT_CONFIG_ExtendedErrorStackForTestHost (false)
411411
#define DEFAULT_CONFIG_ForceSplitScope (false)
412+
#define DEFAULT_CONFIG_DelayFullJITSmallFunc (0)
412413

413414

414415
//Following determines inline thresholds
@@ -1072,6 +1073,7 @@ FLAGNR(Boolean, ForceFastPath , "Force fast-paths in native codegen", DE
10721073
FLAGNR(Boolean, ForceFloatPref , "Force float preferencing (JIT only)", false)
10731074
FLAGNR(Boolean, ForceJITLoopBody , "Force jit loop body only", DEFAULT_CONFIG_ForceJITLoopBody)
10741075
FLAGNR(Boolean, DumpCommentsFromReferencedFiles, "Allow printing comments of comment-table of the referenced file as well (use with -trace:CommentTable)", DEFAULT_CONFIG_DumpCommentsFromReferencedFiles)
1076+
FLAGNR(Number, DelayFullJITSmallFunc , "Scale Full JIT threshold for small functions which are going to be inlined soon. To provide fraction scale, the final scale is scale following this option devided by 10", DEFAULT_CONFIG_DelayFullJITSmallFunc)
10751077

10761078
#ifdef _M_ARM
10771079
FLAGNR(Boolean, ForceLocalsPtr , "Force use of alternative locals pointer (JIT only)", false)

lib/Runtime/Base/FunctionBody.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6834,11 +6834,19 @@ namespace Js
68346834
- If the size is >= 100, scale by 1.6
68356835
*/
68366836
const uint loopPercentage = GetByteCodeInLoopCount() * 100 / max(1u, GetByteCodeCount());
6837-
if(loopPercentage <= 50)
6837+
const int byteCodeSizeThresholdForInlineCandidate = CONFIG_FLAG(InlineThreshold) + CONFIG_FLAG(InlineThresholdAdjustCountInSmallFunction);
6838+
bool delayFullJITThisFunc =
6839+
(CONFIG_FLAG(DelayFullJITSmallFunc) > 0) && (byteCodeSizeThresholdForInlineCandidate < 0 || this->GetByteCodeWithoutLDACount() > (uint)byteCodeSizeThresholdForInlineCandidate);
6840+
6841+
if(loopPercentage <= 50 || delayFullJITThisFunc)
68386842
{
68396843
const uint straightLineSize = GetByteCodeCount() - GetByteCodeInLoopCount();
68406844
double fullJitDelayMultiplier;
6841-
if(straightLineSize < 50)
6845+
if (delayFullJITThisFunc)
6846+
{
6847+
fullJitDelayMultiplier = CONFIG_FLAG(DelayFullJITSmallFunc) / 10.0;
6848+
}
6849+
else if(straightLineSize < 50)
68426850
{
68436851
fullJitDelayMultiplier = 1.2;
68446852
}

0 commit comments

Comments
 (0)