[webkit-changes] [WebKit/WebKit] ba9ef0: [JSC] Add peephole optimization for consecutive moves

Tadeu Zagallo noreply at github.com
Thu Feb 23 23:57:05 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ba9ef0e90d4fcf761af62ba00df66efa57a57776
      https://github.com/WebKit/WebKit/commit/ba9ef0e90d4fcf761af62ba00df66efa57a57776
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-02-23 (Thu, 23 Feb 2023)

  Changed paths:
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

  Log Message:
  -----------
  [JSC] Add peephole optimization for consecutive moves
https://bugs.webkit.org/show_bug.cgi?id=252830
rdar://105834848

Reviewed by Keith Miller.

Add a BytecodeGenerator peephole optimization for removing redundant consecutive
moves into the same virtual register. It isn't very common, but looking at real
world data I see a few hundreds of moves that could be eliminated with a trivial
optimization. A contrived example is the following program:

```
{ if (true) { } }
```

This generates 3 consecutives `mov dst:loc6, src:Undefined`.

* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::initializeVarLexicalEnvironment):
(JSC::BytecodeGenerator::moveLinkTimeConstant):
(JSC::BytecodeGenerator::moveEmptyValue):
(JSC::BytecodeGenerator::emitMove):

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




More information about the webkit-changes mailing list