[webkit-changes] [WebKit/WebKit] 4b665f: [JSC] Fold empty string + value in bytecode generator

Yusuke Suzuki noreply at github.com
Fri Feb 23 02:26:44 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4b665f046f0db0e63fa3f84ee5116897b61c78be
      https://github.com/WebKit/WebKit/commit/4b665f046f0db0e63fa3f84ee5116897b61c78be
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-02-23 (Fri, 23 Feb 2024)

  Changed paths:
    A JSTests/stress/empty-string-add-to-string.js
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

  Log Message:
  -----------
  [JSC] Fold empty string + value in bytecode generator
https://bugs.webkit.org/show_bug.cgi?id=269974
rdar://123492788

Reviewed by Ross Kirsling and Alexey Shvayka.

This pattern is too much seen in the wild. So let's do optimization in bytecode generator level since it is too simple.
When we see `"" + value`, we generate `to_string` bytecode for value.

* JSTests/stress/empty-string-add-to-string.js: Added.
(test1):
(test2):
(shouldBe):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitBinaryOp):

Canonical link: https://commits.webkit.org/275230@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list