From c8865458da8d9a177123c39fa19d511a0d863ecf Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 6 Apr 2025 02:32:04 +0200 Subject: [PATCH] LibJS: Mark exception-handling paths with [[unlikely]] in interpreter This appears actually helpful and consistently makes all benchmarks slightly faster on my machine. --- Libraries/LibJS/Bytecode/Interpreter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibJS/Bytecode/Interpreter.cpp b/Libraries/LibJS/Bytecode/Interpreter.cpp index 496bc30faa3..5c2b622106b 100644 --- a/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -481,7 +481,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point) goto start; \ } \ auto result = op_snake_case(vm(), get(instruction.lhs()), get(instruction.rhs())); \ - if (result.is_error()) { \ + if (result.is_error()) [[unlikely]] { \ if (handle_exception(program_counter, result.error_value()) == HandleExceptionResponse::ExitFromExecutable) \ return; \ goto start; \ @@ -563,7 +563,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point) auto& instruction = *reinterpret_cast(&bytecode[program_counter]); \ { \ auto result = instruction.execute_impl(*this); \ - if (result.is_error()) { \ + if (result.is_error()) [[unlikely]] { \ if (handle_exception(program_counter, result.error_value()) == HandleExceptionResponse::ExitFromExecutable) \ return; \ goto start; \