diff --git a/Userland/Libraries/LibJS/JIT/Compiler.cpp b/Userland/Libraries/LibJS/JIT/Compiler.cpp index 5b168a9587..fdd698d16c 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.cpp +++ b/Userland/Libraries/LibJS/JIT/Compiler.cpp @@ -386,6 +386,20 @@ void Compiler::compile_get_by_id(Bytecode::Op::GetById const& op) check_exception(); } +static Value cxx_get_by_value(VM& vm, Value base, Value property) +{ + return TRY_OR_SET_EXCEPTION(Bytecode::get_by_value(vm.bytecode_interpreter(), base, property)); +} + +void Compiler::compile_get_by_value(Bytecode::Op::GetByValue const& op) +{ + load_vm_register(ARG1, op.base()); + load_vm_register(ARG2, Bytecode::Register::accumulator()); + m_assembler.native_call((void*)cxx_get_by_value); + store_vm_register(Bytecode::Register::accumulator(), RET); + check_exception(); +} + static Value cxx_to_numeric(VM& vm, Value value) { return TRY_OR_SET_EXCEPTION(value.to_numeric(vm)); @@ -478,6 +492,9 @@ OwnPtr Compiler::compile(Bytecode::Executable& bytecode_execut case Bytecode::Instruction::Type::GetById: compiler.compile_get_by_id(static_cast(op)); break; + case Bytecode::Instruction::Type::GetByValue: + compiler.compile_get_by_value(static_cast(op)); + break; case Bytecode::Instruction::Type::ToNumeric: compiler.compile_to_numeric(static_cast(op)); break; diff --git a/Userland/Libraries/LibJS/JIT/Compiler.h b/Userland/Libraries/LibJS/JIT/Compiler.h index 59c043100b..78e502b444 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.h +++ b/Userland/Libraries/LibJS/JIT/Compiler.h @@ -53,6 +53,7 @@ private: void compile_return(Bytecode::Op::Return const&); void compile_new_string(Bytecode::Op::NewString const&); void compile_get_by_id(Bytecode::Op::GetById const&); + void compile_get_by_value(Bytecode::Op::GetByValue const&); void store_vm_register(Bytecode::Register, Assembler::Reg); void load_vm_register(Assembler::Reg, Bytecode::Register);