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

LibJS/JIT: Compile the TypeofVariable bytecode instruction

This commit is contained in:
Andreas Kling 2023-10-21 15:26:03 +02:00
parent d368dc5d25
commit e946440ed3
3 changed files with 21 additions and 0 deletions

View file

@ -550,6 +550,21 @@ void Compiler::compile_call(Bytecode::Op::Call const& op)
check_exception();
}
static Value cxx_typeof_variable(VM& vm, DeprecatedFlyString const& identifier)
{
return TRY_OR_SET_EXCEPTION(Bytecode::typeof_variable(vm, identifier));
}
void Compiler::compile_typeof_variable(Bytecode::Op::TypeofVariable const& op)
{
m_assembler.mov(
Assembler::Operand::Register(ARG1),
Assembler::Operand::Imm64(bit_cast<u64>(&m_bytecode_executable.get_identifier(op.identifier().value()))));
m_assembler.native_call((void*)cxx_typeof_variable);
store_vm_register(Bytecode::Register::accumulator(), RET);
check_exception();
}
OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_executable)
{
if (getenv("LIBJS_NO_JIT"))
@ -641,6 +656,9 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_execut
case Bytecode::Instruction::Type::Call:
compiler.compile_call(static_cast<Bytecode::Op::Call const&>(op));
break;
case Bytecode::Instruction::Type::TypeofVariable:
compiler.compile_typeof_variable(static_cast<Bytecode::Op::TypeofVariable const&>(op));
break;
#define DO_COMPILE_COMMON_BINARY_OP(TitleCaseName, snake_case_name) \
case Bytecode::Instruction::Type::TitleCaseName: \