1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2023-10-26 15:06:58 +02:00
parent 022974a43a
commit 72c31fdd01
2 changed files with 0 additions and 41 deletions

View file

@ -43,19 +43,6 @@ public:
DeprecatedString const& name() const { return m_name; } DeprecatedString const& name() const { return m_name; }
// ==============================================================
// FIXME: This is JIT state and shouldn't be part of BasicBlock itself.
// Offset into the instruction stream where this code block starts.
size_t offset { 0 };
// Offsets into the instruction stream where we have RIP-relative jump offsets to here that need patching.
Vector<size_t> jumps_to_here;
// Offsets into the instruction stream where we have absolute 64-bit references to here that need patching.
Vector<size_t> absolute_references_to_here;
// ==============================================================
private: private:
explicit BasicBlock(DeprecatedString name); explicit BasicBlock(DeprecatedString name);

View file

@ -7,7 +7,6 @@
#pragma once #pragma once
#include <AK/Vector.h> #include <AK/Vector.h>
#include <LibJS/Bytecode/BasicBlock.h>
namespace JS::JIT { namespace JS::JIT {
@ -247,33 +246,6 @@ struct Assembler {
emit8(0x0b); emit8(0x0b);
} }
void jump(Bytecode::BasicBlock& target)
{
// jmp target (RIP-relative 32-bit offset)
emit8(0xe9);
target.jumps_to_here.append(m_output.size());
emit32(0xdeadbeef);
}
void jump_conditional(Reg reg, Bytecode::BasicBlock& true_target, Bytecode::BasicBlock& false_target)
{
// if (reg & 1) is 0, jump to false_target, else jump to true_target
// test reg, 1
emit8(0x48 | ((to_underlying(reg) >= 8) ? 1 << 2 : 0));
emit8(0xf7);
emit8(0xc0 | encode_reg(reg));
emit32(0x01);
// jz false_target (RIP-relative 32-bit offset)
emit8(0x0f);
emit8(0x84);
false_target.jumps_to_here.append(m_output.size());
emit32(0xdeadbeef);
// jmp true_target (RIP-relative 32-bit offset)
jump(true_target);
}
void cmp(Operand lhs, Operand rhs) void cmp(Operand lhs, Operand rhs)
{ {
if (lhs.type == Operand::Type::Reg && rhs.type == Operand::Type::Reg) { if (lhs.type == Operand::Type::Reg && rhs.type == Operand::Type::Reg) {