Skip to content

Commit 9a951e2

Browse files
committed
[MERGE #5744 @nhat-nguyen] Remove unused parameter in DoStackArgsOpt
Merge pull request #5744 from nhat-nguyen:stackargs `DoStackArgsOpt` takes a `topFunc` parameter but doesn't use it. It seems like the intention is to pass it to `IsStackArgsEnabled`, but `topFunc` is actually referenced inside `IsStackArgsEnabled` through a pointer in m_func, making passing in the argument unnecessary.
2 parents 33c525c + 660e1d5 commit 9a951e2

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

lib/Backend/BackwardPass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ BackwardPass::MarkScopeObjSymUseForStackArgOpt()
295295
IR::Instr * instr = this->currentInstr;
296296
if (tag == Js::DeadStorePhase)
297297
{
298-
if (instr->DoStackArgsOpt(this->func) && instr->m_func->GetScopeObjSym() != nullptr && this->DoByteCodeUpwardExposedUsed())
298+
if (instr->DoStackArgsOpt() && instr->m_func->GetScopeObjSym() != nullptr && this->DoByteCodeUpwardExposedUsed())
299299
{
300300
if (this->currentBlock->byteCodeUpwardExposedUsed == nullptr)
301301
{
@@ -315,7 +315,7 @@ BackwardPass::ProcessBailOnStackArgsOutOfActualsRange()
315315
(instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) &&
316316
instr->HasBailOutInfo() && !IsPrePass())
317317
{
318-
if (instr->DoStackArgsOpt(this->func))
318+
if (instr->DoStackArgsOpt())
319319
{
320320
AssertMsg(instr->GetBailOutKind() & IR::BailOnStackArgsOutOfActualsRange, "Stack args bail out is not set when the optimization is turned on? ");
321321
if (instr->GetBailOutKind() & ~IR::BailOnStackArgsOutOfActualsRange)
@@ -3922,7 +3922,7 @@ IR::Instr *
39223922
BackwardPass::TryChangeInstrForStackArgOpt()
39233923
{
39243924
IR::Instr * instr = this->currentInstr;
3925-
if (tag == Js::DeadStorePhase && instr->DoStackArgsOpt(this->func))
3925+
if (tag == Js::DeadStorePhase && instr->DoStackArgsOpt())
39263926
{
39273927
switch (instr->m_opcode)
39283928
{

lib/Backend/FlowGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3421,7 +3421,7 @@ FlowGraph::RemoveInstr(IR::Instr *instr, GlobOpt * globOpt)
34213421
* - When we restore HeapArguments object in the bail out path, it expects the scope object also to be restored - if one was created.
34223422
*/
34233423
Js::OpCode opcode = instr->m_opcode;
3424-
if (opcode == Js::OpCode::LdElemI_A && instr->DoStackArgsOpt(this->func) &&
3424+
if (opcode == Js::OpCode::LdElemI_A && instr->DoStackArgsOpt() &&
34253425
globOpt->CurrentBlockData()->IsArgumentsOpnd(instr->GetSrc1()) && instr->m_func->GetScopeObjSym())
34263426
{
34273427
IR::ByteCodeUsesInstr * byteCodeUsesInstr = IR::ByteCodeUsesInstr::New(instr);

lib/Backend/GlobOpt.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,7 @@ GlobOpt::OptInstr(IR::Instr *&instr, bool* isInstrRemoved)
24072407

24082408
//StackArguments Optimization - We bail out if the index is out of range of actuals.
24092409
if ((instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) &&
2410-
instr->DoStackArgsOpt(this->func) && !this->IsLoopPrePass())
2410+
instr->DoStackArgsOpt() && !this->IsLoopPrePass())
24112411
{
24122412
GenerateBailAtOperation(&instr, IR::BailOnStackArgsOutOfActualsRange);
24132413
}
@@ -5179,7 +5179,7 @@ GlobOpt::ValueNumberLdElemDst(IR::Instr **pInstr, Value *srcVal)
51795179

51805180
IR::IndirOpnd *src = instr->GetSrc1()->AsIndirOpnd();
51815181
const ValueType baseValueType(src->GetBaseOpnd()->GetValueType());
5182-
if (instr->DoStackArgsOpt(this->func) ||
5182+
if (instr->DoStackArgsOpt() ||
51835183
!(
51845184
baseValueType.IsLikelyOptimizedTypedArray() ||
51855185
(baseValueType.IsLikelyNativeArray() && instr->IsProfiledInstr()) // Specialized native array lowering for LdElem requires that it is profiled.
@@ -5203,7 +5203,7 @@ GlobOpt::ValueNumberLdElemDst(IR::Instr **pInstr, Value *srcVal)
52035203
this->func->GetDebugNumberSet(debugStringBuffer),
52045204
Js::OpCodeUtil::GetOpCodeName(instr->m_opcode),
52055205
baseValueTypeStr,
5206-
instr->DoStackArgsOpt(this->func) ? _u("instruction uses the arguments object") :
5206+
instr->DoStackArgsOpt() ? _u("instruction uses the arguments object") :
52075207
baseValueType.IsLikelyOptimizedTypedArray() ? _u("index is negative or likely not int") : _u("of array type"));
52085208
Output::Flush();
52095209
}
@@ -10753,7 +10753,7 @@ GlobOpt::TypeSpecializeStElem(IR::Instr ** pInstr, Value *src1Val, Value **pDstV
1075310753

1075410754
IR::RegOpnd *baseOpnd = instr->GetDst()->AsIndirOpnd()->GetBaseOpnd();
1075510755
ValueType baseValueType(baseOpnd->GetValueType());
10756-
if (instr->DoStackArgsOpt(this->func) ||
10756+
if (instr->DoStackArgsOpt() ||
1075710757
(!this->DoTypedArrayTypeSpec() && baseValueType.IsLikelyOptimizedTypedArray()) ||
1075810758
(!this->DoNativeArrayTypeSpec() && baseValueType.IsLikelyNativeArray()) ||
1075910759
!(baseValueType.IsLikelyOptimizedTypedArray() || baseValueType.IsLikelyNativeArray()))
@@ -10769,7 +10769,7 @@ GlobOpt::TypeSpecializeStElem(IR::Instr ** pInstr, Value *src1Val, Value **pDstV
1076910769
this->func->GetDebugNumberSet(debugStringBuffer),
1077010770
Js::OpCodeUtil::GetOpCodeName(instr->m_opcode),
1077110771
baseValueTypeStr,
10772-
instr->DoStackArgsOpt(this->func) ?
10772+
instr->DoStackArgsOpt() ?
1077310773
_u("instruction uses the arguments object") :
1077410774
_u("typed array type specialization is disabled, or base is not an optimized typed array"));
1077510775
Output::Flush();
@@ -15625,7 +15625,7 @@ GlobOpt::DoArrayCheckHoist() const
1562515625
bool
1562615626
GlobOpt::DoArrayCheckHoist(const ValueType baseValueType, Loop* loop, IR::Instr const * const instr) const
1562715627
{
15628-
if(!DoArrayCheckHoist() || (instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func)))
15628+
if(!DoArrayCheckHoist() || (instr && !IsLoopPrePass() && instr->DoStackArgsOpt()))
1562915629
{
1563015630
return false;
1563115631
}
@@ -15759,7 +15759,7 @@ GlobOpt::DoLdLenIntSpec(IR::Instr * const instr, const ValueType baseValueType)
1575915759
if(PHASE_OFF(Js::LdLenIntSpecPhase, func) ||
1576015760
IsTypeSpecPhaseOff(func) ||
1576115761
(func->HasProfileInfo() && func->GetReadOnlyProfileInfo()->IsLdLenIntSpecDisabled()) ||
15762-
(instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func)))
15762+
(instr && !IsLoopPrePass() && instr->DoStackArgsOpt()))
1576315763
{
1576415764
return false;
1576515765
}

lib/Backend/IR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Instr::IsPlainInstr() const
6868
}
6969

7070
bool
71-
Instr::DoStackArgsOpt(Func *topFunc) const
71+
Instr::DoStackArgsOpt() const
7272
{
7373
return this->usesStackArgumentsObject && m_func->IsStackArgsEnabled();
7474
}

lib/Backend/IR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class Instr
214214
bool StartsBasicBlock() const;
215215
bool EndsBasicBlock() const;
216216
bool HasFallThrough() const;
217-
bool DoStackArgsOpt(Func *topFunc) const;
217+
bool DoStackArgsOpt() const;
218218
bool HasAnyLoadHeapArgsOpCode();
219219
bool IsEqual(IR::Instr *instr) const;
220220

lib/Backend/Lower.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6022,7 +6022,7 @@ Lowerer::GenerateFastLdMethodFromFlags(IR::Instr * instrLdFld)
60226022

60236023
IR::PropertySymOpnd * propertySymOpnd = opndSrc->AsPropertySymOpnd();
60246024

6025-
Assert(!instrLdFld->DoStackArgsOpt(this->m_func));
6025+
Assert(!instrLdFld->DoStackArgsOpt());
60266026

60276027
if (propertySymOpnd->IsTypeCheckSeqCandidate())
60286028
{
@@ -9176,7 +9176,7 @@ Lowerer::LowerLdElemI(IR::Instr * instr, IR::JnHelperMethod helperMethod, bool i
91769176
return instrPrev;
91779177
}
91789178

9179-
if (!isHelper && instr->DoStackArgsOpt(this->m_func))
9179+
if (!isHelper && instr->DoStackArgsOpt())
91809180
{
91819181
IR::LabelInstr * labelLdElem = IR::LabelInstr::New(Js::OpCode::Label, instr->m_func);
91829182
// Pass in null for labelFallThru to only generate the LdHeapArgument call
@@ -17673,12 +17673,12 @@ Lowerer::GenerateFastLdElemI(IR::Instr *& ldElem, bool *instrIsInHelperBlockRef)
1767317673
labelFallThru = ldElem->GetOrCreateContinueLabel();
1767417674
labelHelper = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, true);
1767517675
// If we know for sure (based on flow graph) we're loading from the arguments object, then ignore the (path-based) profile info.
17676-
bool isNativeArrayLoad = !ldElem->DoStackArgsOpt(this->m_func) && indirOpnd->GetBaseOpnd()->GetValueType().IsLikelyNativeArray();
17676+
bool isNativeArrayLoad = !ldElem->DoStackArgsOpt() && indirOpnd->GetBaseOpnd()->GetValueType().IsLikelyNativeArray();
1767717677
bool needMissingValueCheck = true;
1767817678
bool emittedFastPath = false;
1767917679
bool emitBailout = false;
1768017680

17681-
if (ldElem->DoStackArgsOpt(this->m_func))
17681+
if (ldElem->DoStackArgsOpt())
1768217682
{
1768317683
emittedFastPath = GenerateFastArgumentsLdElemI(ldElem, labelFallThru);
1768417684
emitBailout = true;
@@ -18969,7 +18969,7 @@ Lowerer::GenerateFastLdLen(IR::Instr *ldLen, bool *instrIsInHelperBlockRef)
1896918969

1897018970
IR::LabelInstr *const labelHelper = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, true);
1897118971

18972-
if (ldLen->DoStackArgsOpt(this->m_func))
18972+
if (ldLen->DoStackArgsOpt())
1897318973
{
1897418974
GenerateFastArgumentsLdLen(ldLen, ldLen->GetOrCreateContinueLabel());
1897518975
ldLen->Remove();
@@ -21673,7 +21673,7 @@ Lowerer::GenerateFastArgumentsLdElemI(IR::Instr* ldElem, IR::LabelInstr *labelFa
2167321673
//labelCreateHeapArgs:
2167421674
// ---Bail out to create Heap Arguments object
2167521675

21676-
Assert(ldElem->DoStackArgsOpt(this->m_func));
21676+
Assert(ldElem->DoStackArgsOpt());
2167721677

2167821678
IR::IndirOpnd *indirOpnd = ldElem->GetSrc1()->AsIndirOpnd();
2167921679
bool isInlinee = ldElem->m_func->IsInlinee();
@@ -21804,7 +21804,7 @@ Lowerer::GenerateFastArgumentsLdLen(IR::Instr *ldLen, IR::LabelInstr* labelFallT
2180421804
// JMP $fallthrough
2180521805
//$helper:
2180621806

21807-
Assert(ldLen->DoStackArgsOpt(this->m_func));
21807+
Assert(ldLen->DoStackArgsOpt());
2180821808

2180921809
if(ldLen->m_func->IsInlinee())
2181021810
{
@@ -22005,7 +22005,7 @@ Lowerer::GenerateFastLdFld(IR::Instr * const instrLdFld, IR::JnHelperMethod help
2200522005
IR::Opnd * opndSrc = instrLdFld->GetSrc1();
2200622006
AssertMsg(opndSrc->IsSymOpnd() && opndSrc->AsSymOpnd()->IsPropertySymOpnd() && opndSrc->AsSymOpnd()->m_sym->IsPropertySym(), "Expected PropertySym as src of LdFld");
2200722007

22008-
Assert(!instrLdFld->DoStackArgsOpt(this->m_func));
22008+
Assert(!instrLdFld->DoStackArgsOpt());
2200922009

2201022010
IR::PropertySymOpnd * propertySymOpnd = opndSrc->AsPropertySymOpnd();
2201122011
PropertySym * propertySym = propertySymOpnd->m_sym->AsPropertySym();

0 commit comments

Comments
 (0)