1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00
Commit graph

21 commits

Author SHA1 Message Date
Andreas Kling
5b87d26027 LibJIT+LibJS: Move JIT::Assembler into a new LibJIT library
This will allow other parts of the system to generate machine code
at runtime. :^)
2023-10-27 19:07:22 +02:00
Andreas Kling
72c31fdd01 LibJS: Remove all interactions between Assembler and BasicBlock
With this change, Assembler is now free from LibJS concepts and could
move out to its own apartment. :^)
2023-10-27 19:07:22 +02:00
Andreas Kling
022974a43a LibJS/JIT: Let Compiler keep per-BasicBlock state internally
Compiler now has a BasicBlockData struct for each BasicBlock. The struct
contains all the stuff that we previously stored with the
Bytecode::BasicBlock.
2023-10-27 19:07:22 +02:00
Andreas Kling
5bd93f34af LibJS/JIT: Sign-extend integers before comparing in LessThan fast path 2023-10-27 19:07:22 +02:00
Andreas Kling
4b7f5f4ae7 LibJS/JIT: Allow multiple jumps to the same Assembler::Label 2023-10-27 19:07:22 +02:00
Andreas Kling
1fb95c7df9 LibJS/JIT: Add fast path for LessThan Int32 < Int32
This uses a new branch_if_both_int32() helper.

It's interesting to note that we can compare encoded Int32 values
without stripping the INT32_TAG, since it doesn't affect signedness
of values.
2023-10-27 19:07:22 +02:00
Andreas Kling
895c613400 LibJS/JIT: Fix encoding of CMP reg,reg 2023-10-27 19:07:22 +02:00
Andreas Kling
ea65214c57 LibJS/JIT: Add fast path for Increment with Int32 value
This uses a new branch_if_int32() mechanism that takes a code generating
lambda whose code will run if the input register is an Int32 JS::Value.
2023-10-27 19:07:22 +02:00
Andreas Kling
aeb9bd3bf1 LibJS/JIT: Fix encoding of x86_64 AND reg, reg 2023-10-27 19:07:22 +02:00
Andreas Kling
decc221109 LibJS/JIT: Save and restore callee-saved registers in jitted code 2023-10-27 19:07:22 +02:00
Andreas Kling
9d35016284 LibJS/JIT: Add Assembler::jump(Operand) and verify_not_reached()
Yet another jump() overload, and also a way to crash if we end up
somewhere we shouldn't be while in jitted code.
2023-10-27 19:07:22 +02:00
Andreas Kling
2e6c02f088 LibJS/JIT: Support Imm32 operands in Assembler::push() 2023-10-27 19:07:22 +02:00
Andreas Kling
71e41418f6 LibJS/JIT: Do "enter & leave" sequence in x86_64 machine code
This ensures that the stack pointer is restored before we return from
the jitted code.
2023-10-27 19:07:22 +02:00
Andreas Kling
814b07a9c2 LibJS/JIT: Add Assembler::jump_if_equal()
And also factor out cmp() so we don't have to repeat it.
2023-10-27 19:07:22 +02:00
Andreas Kling
c21978ead6 LibJS/JIT: Remove unused functions from Assembler 2023-10-27 19:07:22 +02:00
Andreas Kling
1e8c6d3b06 LibJS/JIT: Use mov() helper in Assembler::native_call() 2023-10-27 19:07:22 +02:00
Andreas Kling
e7ce3d271a LibJS/JIT: Add Assembler::add() and sub() helpers 2023-10-27 19:07:22 +02:00
Andreas Kling
10dcb4d53a LibJS/JIT: Add Assembler::push() and pop() helpers 2023-10-27 19:07:22 +02:00
Andreas Kling
acece9057e LibJS/JIT: Make Assembler::Reg represent X86 registers
And move the generic register aliases to JIT::Compiler.
2023-10-27 19:07:22 +02:00
Andreas Kling
f9041c7b31 LibJS/JIT: Fast path for boolean JS::Value in compile_to_boolean() 2023-10-27 19:07:22 +02:00
Andreas Kling
babdc0a25b LibJS: Work-in-progress JIT compiler :^) 2023-10-27 19:07:22 +02:00