@@ -3856,7 +3856,7 @@ BackwardPass::DeadStoreOrChangeInstrForScopeObjRemoval(IR::Instr ** pInstrPrev)
3856
3856
IR::Instr * instr = this ->currentInstr ;
3857
3857
Func * currFunc = instr->m_func ;
3858
3858
3859
- if (this ->tag == Js::DeadStorePhase && instr->m_func ->IsStackArgsEnabled () && ! IsPrePass () )
3859
+ if (this ->tag == Js::DeadStorePhase && instr->m_func ->IsStackArgsEnabled ())
3860
3860
{
3861
3861
switch (instr->m_opcode )
3862
3862
{
@@ -3875,28 +3875,37 @@ BackwardPass::DeadStoreOrChangeInstrForScopeObjRemoval(IR::Instr ** pInstrPrev)
3875
3875
if (IsFormalParamSym (currFunc, sym))
3876
3876
{
3877
3877
AssertMsg (!currFunc->GetJITFunctionBody ()->HasImplicitArgIns (), " We don't have mappings between named formals and arguments object here" );
3878
-
3879
- instr->m_opcode = Js::OpCode::Ld_A;
3878
+
3880
3879
PropertySym * propSym = sym->AsPropertySym ();
3881
3880
Js::ArgSlot value = (Js::ArgSlot)propSym->m_propertyId ;
3882
3881
3883
3882
Assert (currFunc->HasStackSymForFormal (value));
3884
3883
StackSym * paramStackSym = currFunc->GetStackSymForFormal (value);
3885
- IR::RegOpnd * srcOpnd = IR::RegOpnd::New (paramStackSym, TyVar, currFunc);
3886
- instr->ReplaceSrc1 (srcOpnd);
3887
- this ->ProcessSymUse (paramStackSym, true , true );
3888
3884
3889
- if (PHASE_VERBOSE_TRACE1 (Js::StackArgFormalsOptPhase ))
3885
+ if (! IsPrePass ( ))
3890
3886
{
3891
- Output::Print (_u (" StackArgFormals : %s (%d) :Replacing LdSlot with Ld_A in Deadstore pass. \n " ), instr->m_func ->GetJITFunctionBody ()->GetDisplayName (), instr->m_func ->GetFunctionNumber ());
3892
- Output::Flush ();
3887
+ IR::RegOpnd * srcOpnd = IR::RegOpnd::New (paramStackSym, TyVar, currFunc);
3888
+ instr->ReplaceSrc1 (srcOpnd);
3889
+ instr->m_opcode = Js::OpCode::Ld_A;
3890
+
3891
+ if (PHASE_VERBOSE_TRACE1 (Js::StackArgFormalsOptPhase))
3892
+ {
3893
+ Output::Print (_u (" StackArgFormals : %s (%d) :Replacing LdSlot with Ld_A in Deadstore pass. \n " ), instr->m_func ->GetJITFunctionBody ()->GetDisplayName (), instr->m_func ->GetFunctionNumber ());
3894
+ Output::Flush ();
3895
+ }
3893
3896
}
3897
+
3898
+ this ->ProcessSymUse (paramStackSym, true , true );
3894
3899
}
3895
3900
}
3896
3901
break ;
3897
3902
}
3898
3903
case Js::OpCode::CommitScope:
3899
3904
{
3905
+ if (IsPrePass ())
3906
+ {
3907
+ break ;
3908
+ }
3900
3909
if (instr->GetSrc1 ()->IsScopeObjOpnd (currFunc))
3901
3910
{
3902
3911
instr->Remove ();
@@ -3907,6 +3916,10 @@ BackwardPass::DeadStoreOrChangeInstrForScopeObjRemoval(IR::Instr ** pInstrPrev)
3907
3916
case Js::OpCode::BrFncCachedScopeEq:
3908
3917
case Js::OpCode::BrFncCachedScopeNeq:
3909
3918
{
3919
+ if (IsPrePass ())
3920
+ {
3921
+ break ;
3922
+ }
3910
3923
if (instr->GetSrc2 ()->IsScopeObjOpnd (currFunc))
3911
3924
{
3912
3925
instr->Remove ();
@@ -3916,6 +3929,10 @@ BackwardPass::DeadStoreOrChangeInstrForScopeObjRemoval(IR::Instr ** pInstrPrev)
3916
3929
}
3917
3930
case Js::OpCode::CallHelper:
3918
3931
{
3932
+ if (IsPrePass ())
3933
+ {
3934
+ break ;
3935
+ }
3919
3936
// Remove the CALL and all its Argout instrs.
3920
3937
if (instr->GetSrc1 ()->AsHelperCallOpnd ()->m_fnHelper == IR::JnHelperMethod::HelperOP_InitCachedFuncs)
3921
3938
{
@@ -3954,15 +3971,21 @@ BackwardPass::DeadStoreOrChangeInstrForScopeObjRemoval(IR::Instr ** pInstrPrev)
3954
3971
3955
3972
if (instr->GetSrc1 ()->IsScopeObjOpnd (currFunc))
3956
3973
{
3957
- instr->m_opcode = Js::OpCode::NewScFunc;
3958
- IR::Opnd * intConstOpnd = instr->UnlinkSrc2 ();
3959
- Assert (intConstOpnd->IsIntConstOpnd ());
3974
+ StackSym * frameDisplaySym = currFunc->GetLocalFrameDisplaySym ();
3975
+ if (!IsPrePass ())
3976
+ {
3977
+ instr->m_opcode = Js::OpCode::NewScFunc;
3978
+ IR::Opnd * intConstOpnd = instr->UnlinkSrc2 ();
3979
+ Assert (intConstOpnd->IsIntConstOpnd ());
3960
3980
3961
- uint nestedFuncIndex = instr->m_func ->GetJITFunctionBody ()->GetNestedFuncIndexForSlotIdInCachedScope (intConstOpnd->AsIntConstOpnd ()->AsUint32 ());
3962
- intConstOpnd->Free (instr->m_func );
3981
+ uint nestedFuncIndex = instr->m_func ->GetJITFunctionBody ()->GetNestedFuncIndexForSlotIdInCachedScope (intConstOpnd->AsIntConstOpnd ()->AsUint32 ());
3982
+ intConstOpnd->Free (instr->m_func );
3983
+
3984
+ instr->ReplaceSrc1 (IR::IntConstOpnd::New (nestedFuncIndex, TyUint32, instr->m_func ));
3985
+ instr->SetSrc2 (IR::RegOpnd::New (frameDisplaySym, IRType::TyVar, currFunc));
3986
+ }
3963
3987
3964
- instr->ReplaceSrc1 (IR::IntConstOpnd::New (nestedFuncIndex, TyUint32, instr->m_func ));
3965
- instr->SetSrc2 (IR::RegOpnd::New (currFunc->GetLocalFrameDisplaySym (), IRType::TyVar, currFunc));
3988
+ this ->ProcessSymUse (frameDisplaySym, true , true );
3966
3989
}
3967
3990
break ;
3968
3991
}
0 commit comments