Skip to content

Commit 359bcf7

Browse files
committed
[MERGE chakra-core#647] Fixing a subtle Switch Opt Assert
Merge pull request chakra-core#647 from satheeshravi:bugFix1 Issue: The interpreter profiles the switch expression as a string. But the globopt sees the value of the expression as an Integer, due to effects of constant folding and BailOnNoProfile. Fix: When such incompatibility is seen, we do a compile time rejit. This is already done when we have a sym. But we were just asserting for this in constant folding path.
2 parents fbee9ed + 9c333b8 commit 359bcf7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/Backend/GlobOpt.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8988,7 +8988,11 @@ GlobOpt::OptConstFoldUnary(
89888988
case Js::OpCode::Ld_A:
89898989
if (instr->HasBailOutInfo())
89908990
{
8991-
Assert(instr->GetBailOutKind() == IR::BailOutExpectingInteger);
8991+
//The profile data for switch expr can be string and in GlobOpt we realize it is an int.
8992+
if(instr->GetBailOutKind() == IR::BailOutExpectingString)
8993+
{
8994+
throw Js::RejitException(RejitReason::DisableSwitchOptExpectingString);
8995+
}
89928996
instr->ClearBailOutInfo();
89938997
}
89948998
value = intConstantValue;

0 commit comments

Comments
 (0)