Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4f03ef594d48c0e71903d2436c8c0be826d84105
      
https://github.com/WebKit/WebKit/commit/4f03ef594d48c0e71903d2436c8c0be826d84105
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    A JSTests/stress/compare-eq-string-and-string-or-other.js
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

  Log Message:
  -----------
  [JSC] Convert CompareEq of String and StringOrOther into CompareStrictEq in 
DFG
https://bugs.webkit.org/show_bug.cgi?id=325583
rdar://188660988

Reviewed by Vassili Bykov.

We found the code like `str[i] == " "` And they eventually hit `i = -1`
and returning undefined. This patch optimizes it by

1. Inserting StringOrOther, then
2. Use CompareStrictEq(String, Untyped).

Then, because of `StringOrOther`, semantics of `==` becomes the same to
`===` in this case, so we can do (2), changing it to CompareStrictEq,
which has significantly optimized form.

Test: JSTests/stress/compare-eq-string-and-string-or-other.js

* JSTests/stress/compare-eq-string-and-string-or-other.js: Added.
(shouldBe):
(isSeparator):
(isSeparatorReversed):
(looseEqual):
(makeRope):
(shouldBe.isSeparatorReversed.toString):
(shouldBe.looseEqual.toString):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):

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



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

Reply via email to