1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +00:00

LibJS/JIT: Consolidate exception handling code

Instead of emitting the lengthy exception checking/handling routine,
we only emit code for checking the presence of an exception and jump
to a common exception handler.

This code size optimization saves 2.08MiB on Kraken/ai-astar.js
This commit is contained in:
Simon Wanner 2023-10-28 18:08:20 +02:00 committed by Andreas Kling
parent 202a08ecc2
commit 2cbc9d6970
2 changed files with 16 additions and 8 deletions

View file

@ -125,6 +125,7 @@ private:
void compile_to_boolean(Assembler::Reg dst, Assembler::Reg src);
void check_exception();
void handle_exception();
void push_unwind_context(bool valid, Optional<Bytecode::Label> const& handler, Optional<Bytecode::Label> const& finalizer);
void pop_unwind_context();
@ -167,6 +168,7 @@ private:
Vector<u8> m_output;
Assembler m_assembler { m_output };
Assembler::Label m_exit_label;
Assembler::Label m_exception_handler;
Bytecode::Executable& m_bytecode_executable;
};