Skip to content

Commit 5a30d13

Browse files
committed
Assign bytecode offset to BrOnException when modifying IR for TryFinally
1 parent ef9955f commit 5a30d13

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/Backend/FlowGraph.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ FlowGraph::Build(void)
317317

318318
Assert(leaveTarget->labelRefs.HasOne());
319319
IR::BranchInstr * brOnException = IR::BranchInstr::New(Js::OpCode::BrOnException, finallyLabel, instr->m_func);
320-
leaveTarget->labelRefs.Head()->InsertBefore(brOnException);
320+
IR::BranchInstr * leaveInstr = leaveTarget->labelRefs.Head();
321+
brOnException->SetByteCodeOffset(leaveInstr);
322+
leaveInstr->InsertBefore(brOnException);
321323

322324
instrPrev = instr->m_prev;
323325
}

lib/Backend/IR.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2715,7 +2715,10 @@ Instr::GetNextByteCodeInstr() const
27152715
{
27162716
IR::BranchInstr* branchInstr = nextInstr->AsBranchInstr();
27172717
AssertMsg(branchInstr->IsUnconditional(), "We can't know which branch to take on a conditionnal branch");
2718-
return branchInstr->GetTarget();
2718+
if (branchInstr->IsUnconditional())
2719+
{
2720+
return branchInstr->GetTarget();
2721+
}
27192722
}
27202723
return nextInstr->GetNextRealInstrOrLabel();
27212724
};

0 commit comments

Comments
 (0)