Skip to content

Conversation

@iidmsa
Copy link
Member

@iidmsa iidmsa commented Jan 25, 2026

c4e25ac

Drop unnecessary usage of ternary operator in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=306221
rdar://168876630

Reviewed by Darin Adler.

This improves readability and enforces more idiomatic C++ by resorting to
equivalent binary boolean operations.

* Source/JavaScriptCore/assembler/CPU.cpp:
(JSC::isARM64E_FPAC):
* Source/JavaScriptCore/bytecode/DeleteByStatus.cpp:
(JSC::DeleteByStatus::computeForStubInfoWithoutExitSiteFeedback):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitGenericEnumeration):
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::ShortCircuitReadModifyResolveNode::emitBytecode):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/parser/Nodes.cpp:
(JSC::BlockNode::hasCompletionValue const):
(JSC::BlockNode::hasEarlyBreakOrContinue const):
(JSC::ScopeNode::hasCompletionValue const):
(JSC::ScopeNode::hasEarlyBreakOrContinue const):
* Source/JavaScriptCore/parser/Nodes.h:
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseFunctionBody):
* Source/JavaScriptCore/runtime/Butterfly.h:
(JSC::Butterfly::totalSize):
* Source/JavaScriptCore/runtime/LiteralParser.cpp:
(JSC::requires):
(JSC::reviverMode>::parse):
* Source/JavaScriptCore/runtime/Options.cpp:
(JSC::OptionRange::isInRange const):
* Source/JavaScriptCore/runtime/VMManager.h:
(JSC::VMManager::isValidVM):

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

37d80a8

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ❌ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 wpe-cairo-libwebrtc
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 vision ✅ 🧪 mac-wk2 ⏳ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ⏳ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🛠 mac-safer-cpp ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@iidmsa iidmsa requested a review from a team as a code owner January 25, 2026 19:56
@iidmsa iidmsa self-assigned this Jan 25, 2026
@iidmsa iidmsa added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Jan 25, 2026
@iidmsa iidmsa requested review from cdumez, darinadler, kmiller68 and weinig and removed request for a team January 25, 2026 19:57
@iidmsa iidmsa force-pushed the eng/Drop-unnecessary-usage-of-ternary-operator-in-JavaScriptCore branch from e4f794b to 37d80a8 Compare January 25, 2026 20:02
Copy link
Member

@darinadler darinadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m comfortable with these. They all seem slightly clearer than the ternary.

@iidmsa iidmsa added the merge-queue Applied to send a pull request to merge-queue label Jan 26, 2026
https://bugs.webkit.org/show_bug.cgi?id=306221
rdar://168876630

Reviewed by Darin Adler.

This improves readability and enforces more idiomatic C++ by resorting to
equivalent binary boolean operations.

* Source/JavaScriptCore/assembler/CPU.cpp:
(JSC::isARM64E_FPAC):
* Source/JavaScriptCore/bytecode/DeleteByStatus.cpp:
(JSC::DeleteByStatus::computeForStubInfoWithoutExitSiteFeedback):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitGenericEnumeration):
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::ShortCircuitReadModifyResolveNode::emitBytecode):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/parser/Nodes.cpp:
(JSC::BlockNode::hasCompletionValue const):
(JSC::BlockNode::hasEarlyBreakOrContinue const):
(JSC::ScopeNode::hasCompletionValue const):
(JSC::ScopeNode::hasEarlyBreakOrContinue const):
* Source/JavaScriptCore/parser/Nodes.h:
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseFunctionBody):
* Source/JavaScriptCore/runtime/Butterfly.h:
(JSC::Butterfly::totalSize):
* Source/JavaScriptCore/runtime/LiteralParser.cpp:
(JSC::requires):
(JSC::reviverMode>::parse):
* Source/JavaScriptCore/runtime/Options.cpp:
(JSC::OptionRange::isInRange const):
* Source/JavaScriptCore/runtime/VMManager.h:
(JSC::VMManager::isValidVM):

Canonical link: https://commits.webkit.org/306188@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Drop-unnecessary-usage-of-ternary-operator-in-JavaScriptCore branch from 37d80a8 to c4e25ac Compare January 26, 2026 07:04
@webkit-commit-queue
Copy link
Collaborator

Committed 306188@main (c4e25ac): https://commits.webkit.org/306188@main

Reviewed commits have been landed. Closing PR #57214 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit c4e25ac into WebKit:main Jan 26, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants