Skip to content

Commit bfd8d23

Browse files
committed
[MERGE chakra-core#2023 @ThomsonTan] Add option to delay full JIT small functions
Merge pull request chakra-core#2023 from ThomsonTan:DelayFullJITSmallFunctions Add a new option -delayFullJITSmallFunc. This is supposed to help JIT through but not turned on this time.
2 parents cda0fc3 + ae18664 commit bfd8d23

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
@@ -6840,11 +6840,19 @@ namespace Js
68406840
- If the size is >= 100, scale by 1.6
68416841
*/
68426842
const uint loopPercentage = GetByteCodeInLoopCount() * 100 / max(1u, GetByteCodeCount());
6843-
if(loopPercentage <= 50)
6843+
const int byteCodeSizeThresholdForInlineCandidate = CONFIG_FLAG(LoopInlineThreshold);
6844+
bool delayFullJITThisFunc =
6845+
(CONFIG_FLAG(DelayFullJITSmallFunc) > 0) && (this->GetByteCodeWithoutLDACount() <= (uint)byteCodeSizeThresholdForInlineCandidate);
6846+
6847+
if(loopPercentage <= 50 || delayFullJITThisFunc)
68446848
{
68456849
const uint straightLineSize = GetByteCodeCount() - GetByteCodeInLoopCount();
68466850
double fullJitDelayMultiplier;
6847-
if(straightLineSize < 50)
6851+
if (delayFullJITThisFunc)
6852+
{
6853+
fullJitDelayMultiplier = CONFIG_FLAG(DelayFullJITSmallFunc) / 10.0;
6854+
}
6855+
else if(straightLineSize < 50)
68486856
{
68496857
fullJitDelayMultiplier = 1.2;
68506858
}

0 commit comments

Comments
 (0)