diff --git a/Userland/Libraries/LibJS/Bytecode/CommonImplementations.cpp b/Userland/Libraries/LibJS/Bytecode/CommonImplementations.cpp index 036d36535c..6638928102 100644 --- a/Userland/Libraries/LibJS/Bytecode/CommonImplementations.cpp +++ b/Userland/Libraries/LibJS/Bytecode/CommonImplementations.cpp @@ -34,10 +34,8 @@ ThrowCompletionOr> base_object_for_get(VM& vm, Value base_v return base_value.to_object(vm); } -ThrowCompletionOr get_by_id(VM& vm, DeprecatedFlyString const& property, Value base_value, Value this_value, u32 cache_index) +ThrowCompletionOr get_by_id(VM& vm, DeprecatedFlyString const& property, Value base_value, Value this_value, PropertyLookupCache& cache) { - auto& cache = vm.bytecode_interpreter().current_executable().property_lookup_caches[cache_index]; - if (base_value.is_string()) { auto string_value = TRY(base_value.as_string().get(vm, property)); if (string_value.has_value()) diff --git a/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h b/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h index addb7d5104..85f3e7fac3 100644 --- a/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h +++ b/Userland/Libraries/LibJS/Bytecode/CommonImplementations.h @@ -13,7 +13,7 @@ namespace JS::Bytecode { ThrowCompletionOr> base_object_for_get(VM&, Value base_value); -ThrowCompletionOr get_by_id(VM&, DeprecatedFlyString const& property, Value base_value, Value this_value, u32 cache_index); +ThrowCompletionOr get_by_id(VM&, DeprecatedFlyString const& property, Value base_value, Value this_value, PropertyLookupCache&); ThrowCompletionOr get_by_value(VM&, Value base_value, Value property_key_value); ThrowCompletionOr get_global(Bytecode::Interpreter&, DeprecatedFlyString const& identifier, u32 cache_index); ThrowCompletionOr put_by_property_key(VM&, Value base, Value this_value, Value value, PropertyKey name, Op::PropertyKind kind); diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index c789e29533..acbde0abcd 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -760,7 +760,8 @@ ThrowCompletionOr SetLocal::execute_impl(Bytecode::Interpreter&) const ThrowCompletionOr GetById::execute_impl(Bytecode::Interpreter& interpreter) const { auto base_value = interpreter.accumulator(); - interpreter.accumulator() = TRY(get_by_id(interpreter.vm(), interpreter.current_executable().get_identifier(m_property), base_value, base_value, m_cache_index)); + auto& cache = interpreter.current_executable().property_lookup_caches[m_cache_index]; + interpreter.accumulator() = TRY(get_by_id(interpreter.vm(), interpreter.current_executable().get_identifier(m_property), base_value, base_value, cache)); return {}; } @@ -768,7 +769,8 @@ ThrowCompletionOr GetByIdWithThis::execute_impl(Bytecode::Interpreter& int { auto base_value = interpreter.accumulator(); auto this_value = interpreter.reg(m_this_value); - interpreter.accumulator() = TRY(get_by_id(interpreter.vm(), interpreter.current_executable().get_identifier(m_property), base_value, this_value, m_cache_index)); + auto& cache = interpreter.current_executable().property_lookup_caches[m_cache_index]; + interpreter.accumulator() = TRY(get_by_id(interpreter.vm(), interpreter.current_executable().get_identifier(m_property), base_value, this_value, cache)); return {}; } diff --git a/Userland/Libraries/LibJS/JIT/Compiler.cpp b/Userland/Libraries/LibJS/JIT/Compiler.cpp index 5ded7822d3..e21f9215fa 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.cpp +++ b/Userland/Libraries/LibJS/JIT/Compiler.cpp @@ -919,9 +919,9 @@ void Compiler::compile_new_class(Bytecode::Op::NewClass const& op) store_accumulator(RET); } -static Value cxx_get_by_id(VM& vm, Value base, DeprecatedFlyString const& property, u32 cache_index) +static Value cxx_get_by_id(VM& vm, Value base, DeprecatedFlyString const& property, Bytecode::PropertyLookupCache& cache) { - return TRY_OR_SET_EXCEPTION(Bytecode::get_by_id(vm, property, base, base, cache_index)); + return TRY_OR_SET_EXCEPTION(Bytecode::get_by_id(vm, property, base, base, cache)); } void Compiler::compile_get_by_id(Bytecode::Op::GetById const& op) @@ -932,7 +932,7 @@ void Compiler::compile_get_by_id(Bytecode::Op::GetById const& op) Assembler::Operand::Imm(bit_cast(&m_bytecode_executable.get_identifier(op.property())))); m_assembler.mov( Assembler::Operand::Register(ARG3), - Assembler::Operand::Imm(op.cache_index())); + Assembler::Operand::Imm(bit_cast(&m_bytecode_executable.property_lookup_caches[op.cache_index()]))); native_call((void*)cxx_get_by_id); store_accumulator(RET); check_exception(); @@ -1575,9 +1575,9 @@ void Compiler::compile_resolve_super_base(Bytecode::Op::ResolveSuperBase const&) check_exception(); } -static Value cxx_get_by_id_with_this(VM& vm, DeprecatedFlyString const& property, Value base_value, Value this_value, u32 cache_index) +static Value cxx_get_by_id_with_this(VM& vm, DeprecatedFlyString const& property, Value base_value, Value this_value, Bytecode::PropertyLookupCache& cache) { - return TRY_OR_SET_EXCEPTION(Bytecode::get_by_id(vm, property, base_value, this_value, cache_index)); + return TRY_OR_SET_EXCEPTION(Bytecode::get_by_id(vm, property, base_value, this_value, cache)); } void Compiler::compile_get_by_id_with_this(Bytecode::Op::GetByIdWithThis const& op) @@ -1589,7 +1589,7 @@ void Compiler::compile_get_by_id_with_this(Bytecode::Op::GetByIdWithThis const& load_vm_register(ARG3, op.this_value()); m_assembler.mov( Assembler::Operand::Register(ARG4), - Assembler::Operand::Imm(op.cache_index())); + Assembler::Operand::Imm(bit_cast(&m_bytecode_executable.property_lookup_caches[op.cache_index()]))); native_call((void*)cxx_get_by_id_with_this); store_accumulator(RET); check_exception();