Skip to content

Commit

Permalink
LibJS/Bytecode: Use ToString instead of generic add() in ConcatString
Browse files Browse the repository at this point in the history
This avoids invoking valueOf() on the values, which is observable.

48 new passes on test262. :^)
  • Loading branch information
awesomekling committed Jun 25, 2023
1 parent 99cc33b commit 8873bf5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Userland/Libraries/LibJS/Bytecode/Op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ ThrowCompletionOr<void> CopyObjectExcludingProperties::execute_impl(Bytecode::In
ThrowCompletionOr<void> ConcatString::execute_impl(Bytecode::Interpreter& interpreter) const
{
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 {};
}

Expand Down

0 comments on commit 8873bf5

Please sign in to comment.