LibJS/Bytecode: Unwind to closest unwind boundary on Throw

This will leave any lexical/variable environments on the way to the
closest unwind context boundary.

This will not leave the closest unwind context, as we still need the
unwind context to perform the Throw instruction correctly.
This commit is contained in:
Luke Wilde 2022-03-14 02:26:39 +00:00 committed by Ali Mohammad Pur
commit 9f4cc6435d
Notes: sideshowbarker 2024-07-17 17:27:05 +09:00
2 changed files with 3 additions and 0 deletions

View file

@ -1441,6 +1441,7 @@ Bytecode::CodeGenerationErrorOr<void> UpdateExpression::generate_bytecode(Byteco
Bytecode::CodeGenerationErrorOr<void> ThrowStatement::generate_bytecode(Bytecode::Generator& generator) const
{
TRY(m_argument->generate_bytecode(generator));
generator.perform_needed_unwinds<Bytecode::Op::Throw>();
generator.emit<Bytecode::Op::Throw>();
return {};
}