1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 10:17:41 +00:00

LibJS/Bytecode: Use ToString instead of generic add() in ConcatString

This avoids invoking valueOf() on the values, which is observable.

48 new passes on test262. :^)
This commit is contained in:
Andreas Kling 2023-06-25 10:55:35 +02:00
parent 99cc33bce9
commit 8873bf5016

View file

@ -380,7 +380,8 @@ ThrowCompletionOr<void> CopyObjectExcludingProperties::execute_impl(Bytecode::In
ThrowCompletionOr<void> ConcatString::execute_impl(Bytecode::Interpreter& interpreter) const ThrowCompletionOr<void> ConcatString::execute_impl(Bytecode::Interpreter& interpreter) const
{ {
auto& vm = interpreter.vm(); auto& vm = interpreter.vm();
interpreter.reg(m_lhs) = TRY(add(vm, interpreter.reg(m_lhs), interpreter.accumulator())); auto string = TRY(interpreter.accumulator().to_primitive_string(vm));
interpreter.reg(m_lhs) = PrimitiveString::create(vm, interpreter.reg(m_lhs).as_string(), string);
return {}; return {};
} }