Skip to content

Commit 8de0522

Browse files
committed
Offline CR fixes
1 parent ab517fb commit 8de0522

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/Backend/IR.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,8 +2697,8 @@ Instr::GetNextBranchOrLabel() const
26972697
IR::Instr *
26982698
Instr::GetNextByteCodeInstr() const
26992699
{
2700-
uint32 currentOffset = GetByteCodeOffset();
27012700
IR::Instr * nextInstr = GetNextRealInstrOrLabel();
2701+
uint32 currentOffset = GetByteCodeOffset();
27022702
const auto getNext = [](IR::Instr* nextInstr) -> IR::Instr*
27032703
{
27042704
if (nextInstr->IsBranchInstr())
@@ -2712,28 +2712,27 @@ Instr::GetNextByteCodeInstr() const
27122712
}
27132713
return nextInstr->GetNextRealInstrOrLabel();
27142714
};
2715-
if (currentOffset == Js::Constants::NoByteCodeOffset)
2715+
while (nextInstr->GetByteCodeOffset() == Js::Constants::NoByteCodeOffset ||
2716+
nextInstr->GetByteCodeOffset() == currentOffset)
27162717
{
2717-
while (nextInstr->GetByteCodeOffset() == Js::Constants::NoByteCodeOffset)
2718-
{
2719-
nextInstr = getNext(nextInstr);
2720-
}
2721-
AssertMsg(nextInstr->GetByteCodeOffset() == 0, "Only instrs before the first one are allowed to not have a bytecode offset");
2718+
nextInstr = getNext(nextInstr);
27222719
}
2723-
else
2720+
2721+
// Do not check if the instr trying to bailout is in the function prologue
2722+
// nextInstr->GetByteCodeOffset() < currentOffset would always be true and we would crash
2723+
if (currentOffset != Js::Constants::NoByteCodeOffset)
27242724
{
2725-
while (nextInstr->GetByteCodeOffset() == Js::Constants::NoByteCodeOffset ||
2726-
nextInstr->GetByteCodeOffset() == currentOffset)
2727-
{
2728-
nextInstr = getNext(nextInstr);
2729-
}
27302725
// This can happen due to break block removal
27312726
while (nextInstr->GetByteCodeOffset() == Js::Constants::NoByteCodeOffset ||
27322727
nextInstr->GetByteCodeOffset() < currentOffset)
27332728
{
27342729
nextInstr = getNext(nextInstr);
27352730
}
27362731
}
2732+
else
2733+
{
2734+
AssertMsg(nextInstr->GetByteCodeOffset() == 0, "Only instrs before the first one are allowed to not have a bytecode offset");
2735+
}
27372736
return nextInstr;
27382737
}
27392738

0 commit comments

Comments
 (0)