[webkit-changes] [WebKit/WebKit] a36c25: [JSC] Spew strict-eq Baseline JIT code with consta...

Yusuke Suzuki noreply at github.com
Sat Feb 10 02:04:04 PST 2024


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

  Changed paths:
    M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
    M Source/JavaScriptCore/jit/JITOpcodes.cpp

  Log Message:
  -----------
  [JSC] Spew strict-eq Baseline JIT code with constant strings
https://bugs.webkit.org/show_bug.cgi?id=269106
rdar://122674588

Reviewed by Alexey Shvayka.

Let's leverage the fact that there are many `"string" === x` comparisons.
In that case, we can emit very specific optimized code even in Baseline JIT easily.
This patch adds `StringIdent === x` case optimizations in Baseline JIT.

Furthermore, we found that

```
    switch (expr) {
    case "string1":
        ...
    case "string2":
        ...
    case variable:
        ...
    }
```

case is emitting very inefficient bytecode, which does not use constant register directly with `jstricteq`.
As a result, my new optimization does not kick in with this. This patch also fixes BytecodeGenerator to make
this new optimization work well by emitting `jstricteq constant, x`.

* Source/JavaScriptCore/jit/JITOpcodes.cpp:
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::compileOpStrictEqJump):

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




More information about the webkit-changes mailing list