@@ -2605,7 +2605,7 @@ LowererMDArch::EmitLongToInt(IR::Opnd *dst, IR::Opnd *src, IR::Instr *instrInser
26052605}
26062606
26072607bool
2608- LowererMDArch::EmitLoadInt32 (IR::Instr *instrLoad, bool conversionFromObjectAllowed)
2608+ LowererMDArch::EmitLoadInt32 (IR::Instr *instrLoad, bool conversionFromObjectAllowed, bool bailOutOnHelper, IR::LabelInstr * labelBailOut )
26092609{
26102610 // if(doShiftFirst)
26112611 // {
@@ -2663,9 +2663,29 @@ LowererMDArch::EmitLoadInt32(IR::Instr *instrLoad, bool conversionFromObjectAllo
26632663 instrLoad->InsertBefore (instr);
26642664 }
26652665
2666- // It could be an integer in this case
2667- if (!isNotInt)
2666+ if (isNotInt)
26682667 {
2668+ // Known to be non-integer. If we are required to bail out on helper call, just re-jit.
2669+ if (!doFloatToIntFastPath && bailOutOnHelper)
2670+ {
2671+ if (!GlobOpt::DoAggressiveIntTypeSpec (this ->m_func ))
2672+ {
2673+ // Aggressive int type specialization is already off for some reason. Prevent trying to rejit again
2674+ // because it won't help and the same thing will happen again. Just abort jitting this function.
2675+ if (PHASE_TRACE (Js::BailOutPhase, this ->m_func ))
2676+ {
2677+ Output::Print (_u (" Aborting JIT because AggressiveIntTypeSpec is already off\n " ));
2678+ Output::Flush ();
2679+ }
2680+ throw Js::OperationAbortedException ();
2681+ }
2682+
2683+ throw Js::RejitException (RejitReason::AggressiveIntTypeSpecDisabled);
2684+ }
2685+ }
2686+ else
2687+ {
2688+ // It could be an integer in this case
26692689 if (doShiftFirst)
26702690 {
26712691 // r1 = SAR r1, VarTag_Shift (move last-shifted bit into CF)
@@ -2781,7 +2801,13 @@ LowererMDArch::EmitLoadInt32(IR::Instr *instrLoad, bool conversionFromObjectAllo
27812801 return true ;
27822802 }
27832803
2784- if (conversionFromObjectAllowed)
2804+ if (bailOutOnHelper)
2805+ {
2806+ Assert (labelBailOut);
2807+ lowererMD->m_lowerer ->InsertBranch (Js::OpCode::Br, labelBailOut, instrLoad);
2808+ instrLoad->Remove ();
2809+ }
2810+ else if (conversionFromObjectAllowed)
27852811 {
27862812 lowererMD->m_lowerer ->LowerUnaryHelperMem (instrLoad, IR::HelperConv_ToInt32);
27872813 }
0 commit comments