1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

LibJS/JIT: Consolidate exits from the jitted code

Instead of emitting the "restore callee-saved registers and return"
sequence again and again, just emit it once at the end of the generated
code, and have everyone jump to it.

This is a code size optimization that saves 207KiB on Kraken/ai-astar.js
This commit is contained in:
Andreas Kling 2023-10-28 13:57:50 +02:00
parent 0768bf2623
commit 9afd12a8ba
2 changed files with 15 additions and 4 deletions

View file

@ -127,6 +127,8 @@ private:
void push_unwind_context(bool valid, Optional<Bytecode::Label> const& handler, Optional<Bytecode::Label> const& finalizer);
void pop_unwind_context();
void jump_to_exit();
template<typename Codegen>
void branch_if_int32(Assembler::Reg, Codegen);
@ -160,6 +162,7 @@ private:
Vector<u8> m_output;
Assembler m_assembler { m_output };
Assembler::Label m_exit_label;
Bytecode::Executable& m_bytecode_executable;
};