Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5085bf6dcfc2d22a7f35f1077bfa0d56ca783e33
      
https://github.com/WebKit/WebKit/commit/5085bf6dcfc2d22a7f35f1077bfa0d56ca783e33
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-07-09 (Wed, 09 Jul 2025)

  Changed paths:
    M Source/JavaScriptCore/bytecode/BytecodeDumper.cpp
    M Source/JavaScriptCore/bytecode/PreciseJumpTargetsInlines.h
    M Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
    M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGMayExit.cpp
    M Source/JavaScriptCore/dfg/DFGOperations.cpp
    M Source/JavaScriptCore/dfg/DFGOperations.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/jit/JIT.cpp
    M Source/JavaScriptCore/jit/JITOpcodes.cpp
    M Source/JavaScriptCore/jit/JITOperations.cpp
    M Source/JavaScriptCore/jit/JITOperations.h
    M Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
    M Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
    M Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
    M Source/JavaScriptCore/parser/Nodes.h

  Log Message:
  -----------
  [JSC] Add list style switch
https://bugs.webkit.org/show_bug.cgi?id=295480
rdar://155116968

Reviewed by Yijia Huang.

Previously, we were giving up using switch_imm / switch_char when
JumpTable becomes too large. But this is problematic since we starts
using if-else instead, and failing to offer structured control flow
information well to Baseline / DFG / FTL as they can do some
optimizations based on these control structures.

In this patch, we introduce ImmList and CharList. When the range is too
large, we start using list of imm & offset / char & offset instead of
jumptable. In LLInt, we do a slow path. In Baseline, DFG, FTL, we do
BinarySwitch based on this information. To make code simple, we add fast
path for switch_imm / switch_char properly in JIT code so we do not need
to handle these different tables in JIT operations functions much.

* Source/JavaScriptCore/bytecode/BytecodeDumper.cpp:
(JSC::CodeBlockBytecodeDumper<Block>::dumpSwitchJumpTables):
* Source/JavaScriptCore/bytecode/PreciseJumpTargetsInlines.h:
* Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedSimpleJumpTable::isList const):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::beginSwitch):
(JSC::BytecodeGenerator::endSwitch):
(JSC::keyForImmediateSwitch): Deleted.
(JSC::keyForCharacterSwitch): Deleted.
(JSC::prepareJumpTableForSwitch): Deleted.
(JSC::prepareJumpTableForStringSwitch): Deleted.
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::CaseBlockNode::tryTableSwitch):
(JSC::CaseBlockNode::emitBytecodeForBlock):
(JSC::length): Deleted.
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* Source/JavaScriptCore/dfg/DFGMayExit.cpp:
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/jit/JIT.cpp:
(JSC::JIT::link):
* Source/JavaScriptCore/jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
* Source/JavaScriptCore/jit/JITOperations.cpp:
(JSC::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/jit/JITOperations.h:
* Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/parser/Nodes.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to