From 72c31fdd01ee8a5119c94ff6168c53e8532035be Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 26 Oct 2023 15:06:58 +0200 Subject: [PATCH] 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. :^) --- .../Libraries/LibJS/Bytecode/BasicBlock.h | 13 --------- Userland/Libraries/LibJS/JIT/Assembler.h | 28 ------------------- 2 files changed, 41 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h index f20a5b632f..cb4d6d05f3 100644 --- a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h +++ b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h @@ -43,19 +43,6 @@ public: 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 jumps_to_here; - - // Offsets into the instruction stream where we have absolute 64-bit references to here that need patching. - Vector absolute_references_to_here; - // ============================================================== - private: explicit BasicBlock(DeprecatedString name); diff --git a/Userland/Libraries/LibJS/JIT/Assembler.h b/Userland/Libraries/LibJS/JIT/Assembler.h index 1adaf24ba4..b744ae2532 100644 --- a/Userland/Libraries/LibJS/JIT/Assembler.h +++ b/Userland/Libraries/LibJS/JIT/Assembler.h @@ -7,7 +7,6 @@ #pragma once #include -#include namespace JS::JIT { @@ -247,33 +246,6 @@ struct Assembler { 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) { if (lhs.type == Operand::Type::Reg && rhs.type == Operand::Type::Reg) {