From e58209e5cf8f342a2309e133250a617b054d21c1 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Fri, 10 Nov 2023 18:51:50 +0200 Subject: [PATCH] LibJS: Skip an always-false branch in the JIT to_boolean slow case --- Userland/Libraries/LibJS/JIT/Compiler.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Value.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/JIT/Compiler.cpp b/Userland/Libraries/LibJS/JIT/Compiler.cpp index 705de343b0..7d13d8adb6 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.cpp +++ b/Userland/Libraries/LibJS/JIT/Compiler.cpp @@ -175,7 +175,7 @@ void Compiler::compile_jump(Bytecode::Op::Jump const& op) static bool cxx_to_boolean(VM&, Value value) { - return value.to_boolean(); + return value.to_boolean_slow_case(); } void Compiler::compile_to_boolean(Assembler::Reg dst, Assembler::Reg src) diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index c08e6b090a..f5ee193f65 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -439,8 +439,9 @@ public: return static_cast(m_value.encoded & 0xFFFFFFFF); } -private: bool to_boolean_slow_case() const; + +private: ThrowCompletionOr to_number_slow_case(VM&) const; ThrowCompletionOr to_numeric_slow_case(VM&) const; ThrowCompletionOr to_primitive_slow_case(VM&, PreferredType) const;