@@ -1984,13 +1984,27 @@ void BailOutRecord::ScheduleFunctionCodeGen(Js::ScriptFunction * function, Js::S
19841984 break ;
19851985
19861986 case IR::BailOutExpectingInteger:
1987- profileInfo->DisableSwitchOpt ();
1988- rejitReason = RejitReason::DisableSwitchOptExpectingInteger;
1987+ if (profileInfo->IsSwitchOptDisabled ())
1988+ {
1989+ reThunk = true ;
1990+ }
1991+ else
1992+ {
1993+ profileInfo->DisableSwitchOpt ();
1994+ rejitReason = RejitReason::DisableSwitchOptExpectingInteger;
1995+ }
19891996 break ;
19901997
19911998 case IR::BailOutExpectingString:
1992- profileInfo->DisableSwitchOpt ();
1993- rejitReason = RejitReason::DisableSwitchOptExpectingString;
1999+ if (profileInfo->IsSwitchOptDisabled ())
2000+ {
2001+ reThunk = true ;
2002+ }
2003+ else
2004+ {
2005+ profileInfo->DisableSwitchOpt ();
2006+ rejitReason = RejitReason::DisableSwitchOptExpectingString;
2007+ }
19942008 break ;
19952009
19962010 case IR::BailOutOnFailedPolymorphicInlineTypeCheck:
@@ -2296,11 +2310,13 @@ void BailOutRecord::ScheduleLoopBodyCodeGen(Js::ScriptFunction * function, Js::S
22962310
22972311 case IR::BailOutExpectingInteger:
22982312 profileInfo->DisableSwitchOpt ();
2313+ executeFunction->SetDontRethunkAfterBailout ();
22992314 rejitReason = RejitReason::DisableSwitchOptExpectingInteger;
23002315 break ;
23012316
23022317 case IR::BailOutExpectingString:
23032318 profileInfo->DisableSwitchOpt ();
2319+ executeFunction->SetDontRethunkAfterBailout ();
23042320 rejitReason = RejitReason::DisableSwitchOptExpectingString;
23052321 break ;
23062322
0 commit comments