[webkit-changes] [WebKit/WebKit] 74d233: [JSC] Fuse `instanceof` bytecodes to one to reduce...
Yijia Huang
noreply at github.com
Tue Sep 24 13:23:15 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 74d23321eec8326b0df93803a0517a92737f368b
https://github.com/WebKit/WebKit/commit/74d23321eec8326b0df93803a0517a92737f368b
Author: Yijia Huang <yijia_huang at apple.com>
Date: 2024-09-24 (Tue, 24 Sep 2024)
Changed paths:
M Source/JavaScriptCore/bytecode/BytecodeList.rb
M Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp
M Source/JavaScriptCore/bytecode/BytecodeOperandsForCheckpoint.h
M Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp
M Source/JavaScriptCore/bytecode/CodeBlock.cpp
M Source/JavaScriptCore/bytecode/GetByStatus.cpp
M Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp
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/jit/BaselineJITRegisters.h
M Source/JavaScriptCore/jit/JIT.cpp
M Source/JavaScriptCore/jit/JITCall.cpp
M Source/JavaScriptCore/jit/JITOpcodes.cpp
M Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
M Source/JavaScriptCore/llint/LLIntSlowPaths.h
M Source/JavaScriptCore/llint/LowLevelInterpreter.asm
M Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
M Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
M Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
M Source/JavaScriptCore/runtime/CommonSlowPaths.h
Log Message:
-----------
[JSC] Fuse `instanceof` bytecodes to one to reduce the emitted bytecode size
https://bugs.webkit.org/show_bug.cgi?id=280013
rdar://136316781
Reviewed by Yusuke Suzuki.
This patch fuses the emitted bytecodes for JavaScript `instanceof` to one
bytecode. As a result, the emitted bytecode size is reduced from 50 bytes
to 7 bytes for `instanceof`. This change not only improves the space
efficiency of the emitted bytecode size, but also improves execution speed
slightly for `instanceof`.
MicroBenchmark Results with `--inner 20 --outer 20`:
before after
instanceof-dynamic 6.3869+-0.0211 ^ 6.3034+-0.0135 ^ definitely 1.0132x faster
instanceof-tricky-dynamic 5.5411+-0.0105 ^ 5.4403+-0.0133 ^ definitely 1.0185x faster
instanceof-inlining 44.5344+-0.0333 ^ 44.4755+-0.0245 ^ definitely 1.0013x faster
instanceof-sometimes-hit 8.2938+-0.0087 ^ 8.1762+-0.0072 ^ definitely 1.0144x faster
instanceof-always-hit-two 6.4538+-0.0070 6.4505+-0.0078
instanceof-always-hit-one 2.4569+-0.0079 ^ 2.4367+-0.0073 ^ definitely 1.0083x faster
instanceof-bound 19.1643+-0.0201 ? 19.2107+-0.0292 ?
<geometric> 9.2039+-0.0072 ^ 9.1531+-0.0072 ^ definitely 1.0055x faster
* Source/JavaScriptCore/bytecode/BytecodeList.rb:
* Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp:
(JSC::tmpLivenessForCheckpoint):
* Source/JavaScriptCore/bytecode/BytecodeOperandsForCheckpoint.h:
(JSC::valueProfileOffsetFor):
* Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp:
(JSC::computeUsesForBytecodeIndexImpl):
(JSC::computeDefsForBytecodeIndexImpl):
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finalizeLLIntInlineCaches):
(JSC::CodeBlock::tryGetValueProfileForBytecodeIndex):
* Source/JavaScriptCore/bytecode/GetByStatus.cpp:
(JSC::GetByStatus::computeFromLLInt):
* Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp:
(JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitInstanceof):
(JSC::BytecodeGenerator::emitInstanceOf): Deleted.
(JSC::BytecodeGenerator::emitInstanceOfCustom): Deleted.
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::InstanceOfNode::emitBytecode):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::progressToNextCheckpoint):
(JSC::DFG::ByteCodeParser::parseBlock):
* Source/JavaScriptCore/jit/BaselineJITRegisters.h:
* Source/JavaScriptCore/jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* Source/JavaScriptCore/jit/JITCall.cpp:
(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emitSlow_op_instanceof):
* Source/JavaScriptCore/jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_instanceof): Deleted.
(JSC::JIT::emitSlow_op_instanceof): Deleted.
* Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::handleOpInstanceofCheckpoint):
(JSC::LLInt::llint_slow_path_checkpoint_osr_exit_from_inlined_call):
(JSC::LLInt::llint_slow_path_checkpoint_osr_exit):
* Source/JavaScriptCore/llint/LLIntSlowPaths.h:
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/runtime/CommonSlowPaths.cpp:
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):
* Source/JavaScriptCore/runtime/CommonSlowPaths.h:
Canonical link: https://commits.webkit.org/284176@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list