1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

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
parent 858bcac4c7
commit 9f4cc6435d
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 {};
}