From 8a24d00b1a66ab7c4ee39723448c32da3cd30041 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 26 Oct 2023 14:52:11 +0200 Subject: [PATCH] LibJS/JIT: Preserve the accumulator across PutByFoo This ensures that we don't clobber the accumulator when putting a value to a setter. --- Userland/Libraries/LibJS/JIT/Compiler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibJS/JIT/Compiler.cpp b/Userland/Libraries/LibJS/JIT/Compiler.cpp index 3fedb18576..11d2b900f8 100644 --- a/Userland/Libraries/LibJS/JIT/Compiler.cpp +++ b/Userland/Libraries/LibJS/JIT/Compiler.cpp @@ -709,6 +709,7 @@ static Value cxx_put_by_id(VM& vm, Value base, Bytecode::IdentifierTableIndex pr { PropertyKey name = vm.bytecode_interpreter().current_executable().get_identifier(property); TRY_OR_SET_EXCEPTION(Bytecode::put_by_property_key(vm, base, base, value, name, kind)); + vm.bytecode_interpreter().accumulator() = value; return {}; } @@ -729,6 +730,7 @@ void Compiler::compile_put_by_id(Bytecode::Op::PutById const& op) static Value cxx_put_by_value(VM& vm, Value base, Value property, Value value, Bytecode::Op::PropertyKind kind) { TRY_OR_SET_EXCEPTION(Bytecode::put_by_value(vm, base, property, value, kind)); + vm.bytecode_interpreter().accumulator() = value; return {}; }