Skip to content

Commit c906220

Browse files
MikeHolmanpleath
authored andcommitted
1 parent e0ce3f0 commit c906220

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

Build/Common.Build.Default.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<PlatformToolset Condition="'$(BuildToolVersion)'=='12.0'">v120</PlatformToolset>
1818
<PlatformToolset Condition="'$(BuildToolVersion)'=='14.0'">v140</PlatformToolset>
1919
<PlatformToolset Condition="'$(BuildToolVersion)'=='15.0'">v141</PlatformToolset>
20+
<PlatformToolset Condition="'$(BuildToolVersion)'=='16.0'">v142</PlatformToolset>
2021
</PropertyGroup>
2122

2223
<!-- Default ChakraDevConfigDir -->

lib/Backend/Inline.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Inline::Optimize(Func *func, __in_ecount_opt(callerArgOutCount) IR::Instr *calle
6969

7070
if (instr->AsLabelInstr()->m_isForInExit)
7171
{
72-
Assert(this->currentForInDepth != 0);
72+
AssertOrFailFast(this->currentForInDepth != 0);
7373
this->currentForInDepth--;
7474
}
7575
}
@@ -2158,14 +2158,12 @@ Inline::InlineBuiltInFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *
21582158
IR::Instr *inlineBuiltInEndInstr = nullptr;
21592159
if (inlineCallOpCode == Js::OpCode::InlineFunctionApply)
21602160
{
2161-
inlineBuiltInEndInstr = InlineApply(callInstr, inlineeData, inlinerData, symCallerThis, pIsInlined, profileId, recursiveInlineDepth, inlineCallArgCount - (usesThisArgument ? 1 : 0));
2162-
return inlineBuiltInEndInstr->m_next;
2161+
return InlineApply(callInstr, inlineeData, inlinerData, symCallerThis, pIsInlined, profileId, recursiveInlineDepth, inlineCallArgCount - (usesThisArgument ? 1 : 0));
21632162
}
21642163

21652164
if (inlineCallOpCode == Js::OpCode::InlineFunctionCall)
21662165
{
2167-
inlineBuiltInEndInstr = InlineCall(callInstr, inlineeData, inlinerData, symCallerThis, pIsInlined, profileId, recursiveInlineDepth);
2168-
return inlineBuiltInEndInstr->m_next;
2166+
return InlineCall(callInstr, inlineeData, inlinerData, symCallerThis, pIsInlined, profileId, recursiveInlineDepth);
21692167
}
21702168

21712169

@@ -2415,9 +2413,10 @@ IR::Instr* Inline::InlineApply(IR::Instr *callInstr, const FunctionJITTimeInfo *
24152413
// We may still decide not to inline.
24162414
*pIsInlined = false;
24172415

2416+
IR::Instr* instrNext = callInstr->m_next;
24182417
if (argsCount == 0)
24192418
{
2420-
return callInstr;
2419+
return instrNext;
24212420
}
24222421

24232422
Js::BuiltinFunction builtInId = Js::JavascriptLibrary::GetBuiltInForFuncInfo(applyData->GetLocalFunctionId());
@@ -2459,7 +2458,7 @@ IR::Instr* Inline::InlineApply(IR::Instr *callInstr, const FunctionJITTimeInfo *
24592458
if (PHASE_OFF1(Js::InlineApplyWithoutArrayArgPhase))
24602459
{
24612460
*pIsInlined = false;
2462-
return callInstr;
2461+
return instrNext;
24632462
}
24642463
*pIsInlined = true;
24652464

@@ -2490,7 +2489,7 @@ IR::Instr* Inline::InlineApply(IR::Instr *callInstr, const FunctionJITTimeInfo *
24902489
{
24912490
INLINE_TESTTRACE(_u("INLINING: Skip Inline: Supporting inlining func.apply(this, array) or func.apply(this, arguments) with formals in the parent function only when func is a built-in inlinable as apply target \tCaller: %s (%s)\n"),
24922491
inlinerData->GetBody()->GetDisplayName(), inlinerData->GetDebugNumberSet(debugStringBuffer));
2493-
return callInstr;
2492+
return instrNext;
24942493
}
24952494
}
24962495

@@ -2506,6 +2505,7 @@ IR::Instr* Inline::InlineApply(IR::Instr *callInstr, const FunctionJITTimeInfo *
25062505

25072506
IR::Instr * Inline::InlineApplyWithArgumentsObject(IR::Instr * callInstr, IR::Instr * argsObjectArgInstr, const FunctionJITTimeInfo * funcInfo)
25082507
{
2508+
IR::Instr* instrNext = callInstr->m_next;
25092509
IR::Instr* ldHeapArguments = argsObjectArgInstr->GetSrc1()->GetStackSym()->GetInstrDef();
25102510
argsObjectArgInstr->ReplaceSrc1(ldHeapArguments->GetDst());
25112511

@@ -2595,14 +2595,15 @@ IR::Instr * Inline::InlineApplyWithArgumentsObject(IR::Instr * callInstr, IR::In
25952595

25962596
argout = IR::Instr::New(Js::OpCode::ArgOut_A_Dynamic, linkOpnd2, explicitThisArgOut->GetSrc1(), linkOpnd1, callInstr->m_func); // push explicit this as this pointer
25972597
callInstr->InsertBefore(argout);
2598-
return callInstr;
2598+
return instrNext;
25992599
}
26002600

26012601
/*
26022602
This method will only do CallDirect style inlining of built-in targets. No script function inlining.
26032603
*/
26042604
IR::Instr * Inline::InlineApplyBuiltInTargetWithArray(IR::Instr * callInstr, const FunctionJITTimeInfo * applyInfo, const FunctionJITTimeInfo * builtInInfo)
26052605
{
2606+
IR::Instr* instrNext = callInstr->m_next;
26062607
IR::Instr * implicitThisArgOut = nullptr;
26072608
IR::Instr * explicitThisArgOut = nullptr;
26082609
IR::Instr * arrayArgOut = nullptr;
@@ -2620,7 +2621,7 @@ IR::Instr * Inline::InlineApplyBuiltInTargetWithArray(IR::Instr * callInstr, con
26202621
IR::Instr* applyTargetLdInstr = nullptr;
26212622
if (!TryGetApplyAndTargetLdInstrs(callInstr, &applyLdInstr, &applyTargetLdInstr))
26222623
{
2623-
return callInstr;
2624+
return instrNext;
26242625
}
26252626
// Fixed function/function object checks for target built-in
26262627
callInstr->ReplaceSrc1(applyTargetLdInstr->GetDst());
@@ -2685,11 +2686,12 @@ IR::Instr * Inline::InlineApplyBuiltInTargetWithArray(IR::Instr * callInstr, con
26852686
callInstr->ReplaceSrc1(helperCallOpnd);
26862687
callInstr->ReplaceSrc2(argOut->GetDst());
26872688

2688-
return callInstr;
2689+
return instrNext;
26892690
}
26902691

26912692
IR::Instr * Inline::InlineApplyWithoutArrayArgument(IR::Instr *callInstr, const FunctionJITTimeInfo * applyInfo, const FunctionJITTimeInfo * applyTargetInfo)
26922693
{
2694+
IR::Instr* instrNext = callInstr->m_next;
26932695
IR::Instr * implicitThisArgOut = nullptr;
26942696
IR::Instr * explicitThisArgOut = nullptr;
26952697
IR::Instr * dummyInstr = nullptr;
@@ -2728,12 +2730,12 @@ IR::Instr * Inline::InlineApplyWithoutArrayArgument(IR::Instr *callInstr, const
27282730

27292731
if (!callTargetStackSym->IsSingleDef())
27302732
{
2731-
return callInstr;
2733+
return instrNext;
27322734
}
27332735

27342736
if (!applyTargetInfo)
27352737
{
2736-
return callInstr;
2738+
return instrNext;
27372739
}
27382740

27392741
bool safeThis = false;
@@ -2745,7 +2747,7 @@ IR::Instr * Inline::InlineApplyWithoutArrayArgument(IR::Instr *callInstr, const
27452747
callInstr->InsertBefore(bytecodeUses);
27462748
}
27472749

2748-
return callInstr;
2750+
return instrNext;
27492751
}
27502752

27512753
void Inline::GetArgInstrsForCallAndApply(IR::Instr* callInstr, IR::Instr** implicitThisArgOut, IR::Instr** explicitThisArgOut, IR::Instr** argumentsOrArrayArgOut, uint &argOutCount)
@@ -3015,7 +3017,7 @@ Inline::InlineCallApplyTarget_Shared(IR::Instr *callInstr, bool originalCallTarg
30153017
// instrNext
30163018
IR::Instr* instrNext = callInstr->m_next;
30173019

3018-
return InlineFunctionCommon(callInstr, originalCallTargetOpndIsJITOpt, originalCallTargetStackSym, inlineeData, inlinee, instrNext, returnValueOpnd, callInstr, nullptr, recursiveInlineDepth, safeThis, isApplyTarget)->m_prev;
3020+
return InlineFunctionCommon(callInstr, originalCallTargetOpndIsJITOpt, originalCallTargetStackSym, inlineeData, inlinee, instrNext, returnValueOpnd, callInstr, nullptr, recursiveInlineDepth, safeThis, isApplyTarget);
30193021
}
30203022

30213023
IR::Opnd *
@@ -3029,14 +3031,15 @@ Inline::ConvertToInlineBuiltInArgOut(IR::Instr * argInstr)
30293031
IR::Instr*
30303032
Inline::InlineCall(IR::Instr *callInstr, const FunctionJITTimeInfo *funcInfo, const FunctionJITTimeInfo * inlinerData, const StackSym *symCallerThis, bool* pIsInlined, uint callSiteId, uint recursiveInlineDepth)
30313033
{
3034+
IR::Instr* instrNext = callInstr->m_next;
30323035
Func *func = callInstr->m_func;
30333036
Js::BuiltinFunction builtInId = Js::JavascriptLibrary::GetBuiltInForFuncInfo(funcInfo->GetLocalFunctionId());
30343037

30353038
*pIsInlined = false;
30363039
if (PHASE_OFF(Js::InlineCallPhase, this->topFunc) || PHASE_OFF(Js::InlineCallPhase, func)
30373040
|| !this->topFunc->GetJITFunctionBody()->GetInParamsCount())
30383041
{
3039-
return callInstr;
3042+
return instrNext;
30403043
}
30413044

30423045
// Convert all the current ARG_OUT to ArgOut_A_InlineBuiltIn
@@ -3045,7 +3048,7 @@ Inline::InlineCall(IR::Instr *callInstr, const FunctionJITTimeInfo *funcInfo, co
30453048
if (!GetDefInstr(linkOpnd)->GetSrc2()->IsSymOpnd())
30463049
{
30473050
// There is no benefit of inlining.call() with no arguments.
3048-
return callInstr;
3051+
return instrNext;
30493052
}
30503053

30513054
*pIsInlined = true;
@@ -3125,7 +3128,7 @@ Inline::InlineCall(IR::Instr *callInstr, const FunctionJITTimeInfo *funcInfo, co
31253128
}
31263129
clonedArgout->SetSrc2(startCall->GetDst());
31273130
Assert(GetDefInstr(orgLinkOpnd) == argImplicitInstr);
3128-
return callInstr;
3131+
return instrNext;
31293132
}
31303133

31313134
bool

0 commit comments

Comments
 (0)