[webkit-changes] [WebKit/WebKit] 2699c1: [JSC] Merge op_enter, op_get_scope and op_check_traps

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


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

  Changed paths:
    M Source/JavaScriptCore/bytecode/PreciseJumpTargets.cpp
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/jit/JIT.cpp
    M Source/JavaScriptCore/jit/JIT.h
    M Source/JavaScriptCore/jit/JITOpcodes.cpp
    M Source/JavaScriptCore/llint/LowLevelInterpreter.asm
    M Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
    M Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

  Log Message:
  -----------
  [JSC] Merge op_enter, op_get_scope and op_check_traps
https://bugs.webkit.org/show_bug.cgi?id=252824
rdar://105833316

Reviewed by Keith Miller.

Every function starts with the same 3 opcodes:

```
op_enter
op_get_scope loc4
op_check_traps
```

This patch changes `op_enter` to also get the scope and checks for VM traps. This
reduces the prologue overhead by 3 bytes.

The one complication is recursive tail calls. Previously we inserted a basic block
right after op_enter, and recursive tail calls entered at opcode #2 (op_get_scope).
Now, in DFG, we have to enter in the middle of op_enter, which is fine, but we can
no longer lazily search for the basic block when we detect a recursive tail call,
so we keep track of the target block for recursive tail calls in InlineStackEntry.

* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::allocateScope):
(JSC::BytecodeGenerator::allocateAndEmitScope): Deleted.
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
(JSC::DFG::ByteCodeParser::handleGetScope):
(JSC::DFG::ByteCodeParser::handleCheckTraps):
(JSC::DFG::ByteCodeParser::parseBlock):
* Source/JavaScriptCore/jit/JIT.cpp:
(JSC::JIT::privateCompileSlowCases):
* Source/JavaScriptCore/jit/JIT.h:
* Source/JavaScriptCore/jit/JITOpcodes.cpp:
(JSC::JIT::emitGetScope):
(JSC::JIT::emitCheckTraps):
(JSC::JIT::emit_op_enter):
(JSC::JIT::emit_op_get_scope):
(JSC::JIT::emit_op_check_traps):
(JSC::JIT::emitSlow_op_enter):
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/runtime/CommonSlowPaths.cpp:
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):

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




More information about the webkit-changes mailing list