From d200361620b6a77f1b5344f75ad2128a57a09ef1 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 28 Oct 2023 19:43:46 +0300 Subject: [PATCH] LibJS: Remove useless indirection in compile_new_{function, regexp} The cxx_new_* functions have the exact same signature as the underlying function they redirect to, so there's no need for them. Removing them saves us a couple of opcodes. --- Userland/Libraries/LibJS/JIT/Compiler.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Userland/Libraries/LibJS/JIT/Compiler.cpp b/Userland/Libraries/LibJS/JIT/Compiler.cpp index 02bc1d27ff..275bb00c00 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.cpp +++ b/Userland/Libraries/LibJS/JIT/Compiler.cpp @@ -617,11 +617,6 @@ void Compiler::compile_new_string(Bytecode::Op::NewString const& op) store_vm_register(Bytecode::Register::accumulator(), RET); } -static Value cxx_new_regexp(VM& vm, Bytecode::ParsedRegex const& parsed_regex, DeprecatedString const& pattern, DeprecatedString const& flags) -{ - return Bytecode::new_regexp(vm, parsed_regex, pattern, flags); -} - void Compiler::compile_new_regexp(Bytecode::Op::NewRegExp const& op) { auto const& parsed_regex = m_bytecode_executable.regex_table->get(op.regex_index()); @@ -638,7 +633,7 @@ void Compiler::compile_new_regexp(Bytecode::Op::NewRegExp const& op) Assembler::Operand::Register(ARG3), Assembler::Operand::Imm(bit_cast(&flags))); - native_call((void*)cxx_new_regexp); + native_call((void*)Bytecode::new_regexp); store_vm_register(Bytecode::Register::accumulator(), RET); } @@ -677,15 +672,6 @@ void Compiler::compile_new_array(Bytecode::Op::NewArray const& op) store_vm_register(Bytecode::Register::accumulator(), RET); } -static Value cxx_new_function( - VM& vm, - FunctionExpression const& function_node, - Optional const& lhs_name, - Optional const& home_object) -{ - return Bytecode::new_function(vm, function_node, lhs_name, home_object); -} - void Compiler::compile_new_function(Bytecode::Op::NewFunction const& op) { m_assembler.mov( @@ -697,7 +683,7 @@ void Compiler::compile_new_function(Bytecode::Op::NewFunction const& op) m_assembler.mov( Assembler::Operand::Register(ARG3), Assembler::Operand::Imm(bit_cast(&op.home_object()))); - native_call((void*)cxx_new_function); + native_call((void*)Bytecode::new_function); store_vm_register(Bytecode::Register::accumulator(), RET); }