Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 73af864d11cf79d7640be78deb260e2533427e58
https://github.com/WebKit/WebKit/commit/73af864d11cf79d7640be78deb260e2533427e58
Author: Yusuke Suzuki <[email protected]>
Date: 2026-09-28 (Mon, 28 Sep 2026)
Changed paths:
A JSTests/stress/bigint-compare-with-zero.js
M Source/JavaScriptCore/dfg/DFGNode.cpp
M Source/JavaScriptCore/dfg/DFGNode.h
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Log Message:
-----------
[JSC] Optimize BigInt comparison with 0n
https://bugs.webkit.org/show_bug.cgi?id=325432
rdar://188534959
Reviewed by Sosuke Suzuki.
0n BigInt has several good characteristics.
1. Only one instance exists per VM.
2. signbit is always not set.
3. length is always zero.
These characteristics make `x <cmp> 0n` significantly optimized.
1. If <cmp> is == / != / === / !==, this becomes pointer comparison.
2. If <cmp> is < / >=, signbit check is enough.
3. If <cmp> is <= / >, signbit and pointer comparison are combined.
Test: JSTests/stress/bigint-compare-with-zero.js
* JSTests/stress/bigint-compare-with-zero.js: Added.
(shouldBe):
(compareRight):
(compareLeft):
(branchRight):
(expectedRight):
(expectedLeft):
* Source/JavaScriptCore/dfg/DFGNode.cpp:
(JSC::DFG::Node::isHeapBigIntZeroConstant):
* Source/JavaScriptCore/dfg/DFGNode.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::tryCompileHeapBigIntCompareWithZero):
(JSC::DFG::SpeculativeJIT::compileHeapBigIntEquality):
(JSC::DFG::SpeculativeJIT::compileHeapBigIntCompare):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
Canonical link: https://commits.webkit.org/322046@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications