Skip to content

Commit 9c23d50

Browse files
committed
[MERGE #5528 @Cellule] Post Op Bailout before first instr
Merge pull request #5528 from Cellule:users/micfer/handlerscope Handle cases where we try to bailout before the first bytecode instr. OS#17686612 Right now, it is possible to have a post-op bailout on LdScopeHandler which is added in IRBuilder. I am not sure how to write a test that triggers this path, it seems specific to browser/node scenario I have checked with @rajatd that a bailout there is fine since we will re-execute the code in the bailout path (more specifically in the first iteration of the interpreter).
2 parents eebca86 + 8de0522 commit 9c23d50

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

lib/Backend/IR.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,11 +2717,21 @@ Instr::GetNextByteCodeInstr() const
27172717
{
27182718
nextInstr = getNext(nextInstr);
27192719
}
2720-
// This can happen due to break block removal
2721-
while (nextInstr->GetByteCodeOffset() == Js::Constants::NoByteCodeOffset ||
2722-
nextInstr->GetByteCodeOffset() < currentOffset)
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)
27232724
{
2724-
nextInstr = getNext(nextInstr);
2725+
// This can happen due to break block removal
2726+
while (nextInstr->GetByteCodeOffset() == Js::Constants::NoByteCodeOffset ||
2727+
nextInstr->GetByteCodeOffset() < currentOffset)
2728+
{
2729+
nextInstr = getNext(nextInstr);
2730+
}
2731+
}
2732+
else
2733+
{
2734+
AssertMsg(nextInstr->GetByteCodeOffset() == 0, "Only instrs before the first one are allowed to not have a bytecode offset");
27252735
}
27262736
return nextInstr;
27272737
}

0 commit comments

Comments
 (0)