瀏覽代碼

LibJS/JIT: Preserve the accumulator across PutByFoo

This ensures that we don't clobber the accumulator when putting a value
to a setter.
Andreas Kling 1 年之前
父節點
當前提交
8a24d00b1a
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Userland/Libraries/LibJS/JIT/Compiler.cpp

+ 2 - 0
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);
     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));
     TRY_OR_SET_EXCEPTION(Bytecode::put_by_property_key(vm, base, base, value, name, kind));
+    vm.bytecode_interpreter().accumulator() = value;
     return {};
     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)
 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));
     TRY_OR_SET_EXCEPTION(Bytecode::put_by_value(vm, base, property, value, kind));
+    vm.bytecode_interpreter().accumulator() = value;
     return {};
     return {};
 }
 }