@@ -476,7 +476,7 @@ Inline::Optimize(Func *func, __in_ecount_opt(callerArgOutCount) IR::Instr *calle
476
476
477
477
// Insert a ByteCodeUsesInstr to make sure the methodValueDstOpnd's constant value is captured by any
478
478
// bailout that occurs between CheckFixedMethodField and CallI.
479
- IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (instr, originalCallTargetStackSym->m_id );
479
+ IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (instr, instr-> GetSrc1 (), originalCallTargetStackSym->m_id );
480
480
instr->InsertBefore (useCallTargetInstr);
481
481
482
482
// Split NewScObject into NewScObjectNoCtor and CallI, but don't touch NewScObjectArray.
@@ -1070,7 +1070,7 @@ void Inline::CompletePolymorphicInlining(IR::Instr* callInstr, IR::RegOpnd* retu
1070
1070
return false ;
1071
1071
});
1072
1072
1073
- callInstr->InsertBefore (IR::ByteCodeUsesInstr::New (callInstr, callInstr->GetSrc1 ()->GetStackSym ()->m_id ));
1073
+ callInstr->InsertBefore (IR::ByteCodeUsesInstr::New (callInstr, callInstr->GetSrc1 (), callInstr-> GetSrc1 () ->GetStackSym ()->m_id ));
1074
1074
1075
1075
IR::Instr* endCallInstr = IR::Instr::New (Js::OpCode::EndCallForPolymorphicInlinee, callInstr->m_func );
1076
1076
endCallInstr->SetSrc1 (IR::IntConstOpnd::New (actualsCount + Js::Constants::InlineeMetaArgCount, TyInt32, callInstr->m_func , /* dontEncode*/ true ));
@@ -2025,7 +2025,7 @@ Inline::InlineBuiltInFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *
2025
2025
// Insert a byteCodeUsesInstr to make sure the function object's lifetime is extended beyond the last bailout point
2026
2026
// at which we may need to call the inlinee again in the interpreter.
2027
2027
{
2028
- IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr, originalCallTargetStackSym->m_id );
2028
+ IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr, callInstr-> GetSrc1 (), originalCallTargetStackSym->m_id );
2029
2029
callInstr->InsertBefore (useCallTargetInstr);
2030
2030
}
2031
2031
@@ -2061,7 +2061,7 @@ Inline::InlineBuiltInFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *
2061
2061
2062
2062
// Insert a byteCodeUsesInstr to make sure the function object's lifetime is extended beyond the last bailout point
2063
2063
// at which we may need to call the inlinee again in the interpreter.
2064
- IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr->GetPrevRealInstrOrLabel (), originalCallTargetStackSym->m_id );
2064
+ IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr->GetPrevRealInstrOrLabel (), callInstr-> GetSrc1 (), originalCallTargetStackSym->m_id );
2065
2065
2066
2066
if (inlineCallOpCode == Js::OpCode::InlineArrayPop)
2067
2067
{
@@ -2423,7 +2423,7 @@ IR::Instr * Inline::InlineApplyWithArgumentsObject(IR::Instr * callInstr, IR::In
2423
2423
// the bailout on non-stack arguments.
2424
2424
if (callInstr->m_opcode == Js::OpCode::CallIFixed)
2425
2425
{
2426
- IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr, originalCallTargetStackSym->m_id );
2426
+ IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr, callInstr-> GetSrc1 (), originalCallTargetStackSym->m_id );
2427
2427
callInstr->InsertBefore (useCallTargetInstr);
2428
2428
}
2429
2429
@@ -2559,7 +2559,7 @@ IR::Instr * Inline::InlineApplyWithoutArrayArgument(IR::Instr *callInstr, const
2559
2559
if (TryOptimizeCallInstrWithFixedMethod (callInstr, applyTargetInfo, false /* isPolymorphic*/ , false /* isBuiltIn*/ , false /* isCtor*/ , true /* isInlined*/ , safeThis /* unused here*/ ))
2560
2560
{
2561
2561
Assert (callInstr->m_opcode == Js::OpCode::CallIFixed);
2562
- callInstr->InsertBefore (IR::ByteCodeUsesInstr::New (callInstr, callTargetStackSym->m_id ));
2562
+ callInstr->InsertBefore (IR::ByteCodeUsesInstr::New (callInstr, callInstr-> GetSrc1 (), callTargetStackSym->m_id ));
2563
2563
}
2564
2564
2565
2565
return callInstr;
@@ -2723,13 +2723,13 @@ bool Inline::InlineApplyScriptTarget(IR::Instr *callInstr, const FunctionJITTime
2723
2723
startCall->SetSrc2 (IR::IntConstOpnd::New (startCall->GetArgOutCount (/* getInterpreterArgOutCount*/ false ), TyUint32, startCall->m_func ));
2724
2724
startCall->GetSrc1 ()->AsIntConstOpnd ()->IncrValue (-1 ); // update the count of argouts as seen by JIT, in the start call instruction
2725
2725
2726
- *returnInstr = InlineCallApplyTarget_Shared (callInstr, originalCallTargetStackSym, inlineeData, inlineCacheIndex,
2726
+ *returnInstr = InlineCallApplyTarget_Shared (callInstr, callInstr-> GetSrc1 (), originalCallTargetStackSym, inlineeData, inlineCacheIndex,
2727
2727
safeThis, /* isApplyTarget*/ true , /* isCallTarget*/ false , recursiveInlineDepth);
2728
2728
return true ;
2729
2729
}
2730
2730
2731
2731
IR::Instr *
2732
- Inline::InlineCallApplyTarget_Shared (IR::Instr *callInstr, StackSym* originalCallTargetStackSym, const FunctionJITTimeInfo *const inlineeData,
2732
+ Inline::InlineCallApplyTarget_Shared (IR::Instr *callInstr, IR::Opnd* originalCallTargetOpnd, StackSym* originalCallTargetStackSym, const FunctionJITTimeInfo *const inlineeData,
2733
2733
uint inlineCacheIndex, bool safeThis, bool isApplyTarget, bool isCallTarget, uint recursiveInlineDepth)
2734
2734
{
2735
2735
Assert (isApplyTarget ^ isCallTarget);
@@ -2810,7 +2810,7 @@ Inline::InlineCallApplyTarget_Shared(IR::Instr *callInstr, StackSym* originalCal
2810
2810
// instrNext
2811
2811
IR::Instr* instrNext = callInstr->m_next ;
2812
2812
2813
- return InlineFunctionCommon (callInstr, originalCallTargetStackSym, inlineeData, inlinee, instrNext, returnValueOpnd, callInstr, nullptr , recursiveInlineDepth, safeThis, isApplyTarget);
2813
+ return InlineFunctionCommon (callInstr, originalCallTargetOpnd, originalCallTargetStackSym, inlineeData, inlinee, instrNext, returnValueOpnd, callInstr, nullptr , recursiveInlineDepth, safeThis, isApplyTarget);
2814
2814
}
2815
2815
2816
2816
IR::Opnd *
@@ -3007,7 +3007,7 @@ Inline::InlineCallTarget(IR::Instr *callInstr, const FunctionJITTimeInfo* inline
3007
3007
startCall->SetSrc2 (IR::IntConstOpnd::New (startCall->GetArgOutCount (/* getInterpreterArgOutCount*/ false ), TyUint32, startCall->m_func ));
3008
3008
startCall->GetSrc1 ()->AsIntConstOpnd ()->SetValue (startCall->GetSrc1 ()->AsIntConstOpnd ()->GetValue () - 1 );
3009
3009
3010
- *returnInstr = InlineCallApplyTarget_Shared (callInstr, originalCallTargetStackSym, inlineeData, inlineCacheIndex,
3010
+ *returnInstr = InlineCallApplyTarget_Shared (callInstr, callInstr-> GetSrc1 (), originalCallTargetStackSym, inlineeData, inlineCacheIndex,
3011
3011
safeThis, /* isApplyTarget*/ false , /* isCallTarget*/ true , recursiveInlineDepth);
3012
3012
3013
3013
return true ;
@@ -3575,11 +3575,11 @@ Inline::InlineGetterSetterFunction(IR::Instr *accessorInstr, const FunctionJITTi
3575
3575
bool safeThis = false ;
3576
3576
TryOptimizeCallInstrWithFixedMethod (accessorInstr, inlineeData, false , false , false , true , safeThis);
3577
3577
3578
- return InlineFunctionCommon (accessorInstr, nullptr , inlineeData, inlinee, instrNext, returnValueOpnd, inlineBailoutChecksBeforeInstr, symCallerThis, recursiveInlineDepth, safeThis);
3578
+ return InlineFunctionCommon (accessorInstr, nullptr , nullptr , inlineeData, inlinee, instrNext, returnValueOpnd, inlineBailoutChecksBeforeInstr, symCallerThis, recursiveInlineDepth, safeThis);
3579
3579
}
3580
3580
3581
3581
IR::Instr *
3582
- Inline::InlineFunctionCommon (IR::Instr *callInstr, StackSym* originalCallTargetStackSym, const FunctionJITTimeInfo *funcInfo, Func *inlinee, IR::Instr *instrNext,
3582
+ Inline::InlineFunctionCommon (IR::Instr *callInstr, IR::Opnd* originalCallTargetOpnd, StackSym* originalCallTargetStackSym, const FunctionJITTimeInfo *funcInfo, Func *inlinee, IR::Instr *instrNext,
3583
3583
IR::RegOpnd * returnValueOpnd, IR::Instr *inlineBailoutChecksBeforeInstr, const StackSym *symCallerThis, uint recursiveInlineDepth, bool safeThis, bool isApplyTarget)
3584
3584
{
3585
3585
BuildIRForInlinee (inlinee, funcInfo->GetBody (), callInstr, isApplyTarget, recursiveInlineDepth);
@@ -3623,11 +3623,12 @@ Inline::InlineFunctionCommon(IR::Instr *callInstr, StackSym* originalCallTargetS
3623
3623
if (callInstr->m_opcode == Js::OpCode::CallIFixed && !inlinee->isGetterSetter )
3624
3624
{
3625
3625
Assert (originalCallTargetStackSym != nullptr );
3626
+ Assert (opnd != nullptr );
3626
3627
3627
3628
// Insert a ByteCodeUsesInstr to make sure the function object's lifetimes is extended beyond the last bailout point
3628
3629
// at which we may have to call the function again in the interpreter.
3629
3630
// Don't need to do this for a getter/setter inlinee as, upon bailout, the execution will start in the interpreter at the LdFld/StFld itself.
3630
- callInstr->InsertBefore (IR::ByteCodeUsesInstr::New (callInstr, originalCallTargetStackSym->m_id ));
3631
+ callInstr->InsertBefore (IR::ByteCodeUsesInstr::New (callInstr, originalCallTargetOpnd, originalCallTargetStackSym->m_id ));
3631
3632
}
3632
3633
3633
3634
// InlineeStart indicate the beginning of the inlinee, and we need the stack arg for the inlinee until InlineeEnd
@@ -3887,7 +3888,7 @@ Inline::InlineScriptFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *co
3887
3888
false );
3888
3889
#endif
3889
3890
3890
- return InlineFunctionCommon (callInstr, originalCallTargetStackSym, inlineeData, inlinee, instrNext, returnValueOpnd, inlineBailoutChecksBeforeInstr, symCallerThis, recursiveInlineDepth, safeThis);
3891
+ return InlineFunctionCommon (callInstr, callInstr-> GetSrc1 (), originalCallTargetStackSym, inlineeData, inlinee, instrNext, returnValueOpnd, inlineBailoutChecksBeforeInstr, symCallerThis, recursiveInlineDepth, safeThis);
3891
3892
}
3892
3893
3893
3894
bool
@@ -4190,7 +4191,7 @@ Inline::TryFixedMethodAndPrepareInsertionPoint(IR::Instr *callInstr, const Funct
4190
4191
Assert (callInstr->m_opcode == Js::OpCode::CallIFixed);
4191
4192
4192
4193
// If we optimized the call instruction for a fixed function, we must extend the function object's lifetime until after the last bailout before the call.
4193
- IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr, originalCallTargetStackSym->m_id );
4194
+ IR::ByteCodeUsesInstr * useCallTargetInstr = IR::ByteCodeUsesInstr::New (callInstr, callInstr-> GetSrc1 (), originalCallTargetStackSym->m_id );
4194
4195
callInstr->InsertBefore (useCallTargetInstr);
4195
4196
}
4196
4197
else
@@ -4387,11 +4388,11 @@ bool Inline::InlConstFold(IR::Instr *instr, IntConstType *pValue, __in_ecount_op
4387
4388
{
4388
4389
if (src1Sym->HasByteCodeRegSlot ())
4389
4390
{
4390
- byteCodeInstr->Set (src1Sym->m_id );
4391
+ byteCodeInstr->Set (src1-> AsRegOpnd (), src1Sym->m_id );
4391
4392
}
4392
4393
if (src2Sym->HasByteCodeRegSlot ())
4393
4394
{
4394
- byteCodeInstr->Set (src2Sym->m_id );
4395
+ byteCodeInstr->Set (src2-> AsRegOpnd (), src2Sym->m_id );
4395
4396
}
4396
4397
instr->InsertBefore (byteCodeInstr);
4397
4398
}
@@ -4426,7 +4427,7 @@ bool Inline::InlConstFold(IR::Instr *instr, IntConstType *pValue, __in_ecount_op
4426
4427
{
4427
4428
IR::ByteCodeUsesInstr * byteCodeInstr = IR::ByteCodeUsesInstr::New (instr->m_func );
4428
4429
byteCodeInstr->SetByteCodeOffset (instr);
4429
- byteCodeInstr->Set (src1Sym->m_id );
4430
+ byteCodeInstr->Set (src1-> AsRegOpnd (), src1Sym->m_id );
4430
4431
instr->InsertBefore (byteCodeInstr);
4431
4432
}
4432
4433
0 commit comments