Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 17d76fab1e3b088fde6a048e60dc130972266ee0
https://github.com/WebKit/WebKit/commit/17d76fab1e3b088fde6a048e60dc130972266ee0
Author: Andrew Fryer <[email protected]>
Date: 2026-06-29 (Mon, 29 Jun 2026)
Changed paths:
M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
M Source/JavaScriptCore/dfg/DFGAbstractValue.cpp
M Source/JavaScriptCore/dfg/DFGAbstractValue.h
M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
M Source/JavaScriptCore/dfg/DFGCommon.h
M Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
M Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp
M Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.h
M Source/JavaScriptCore/dfg/DFGGraph.cpp
M Source/JavaScriptCore/dfg/DFGGraph.h
M Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.cpp
M Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.h
M Source/JavaScriptCore/dfg/DFGStructureAbstractValue.cpp
M Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h
M Source/JavaScriptCore/dfg/DFGValidate.cpp
M Source/JavaScriptCore/runtime/Structure.h
M Source/JavaScriptCore/runtime/StructureRareDataInlines.h
Log Message:
-----------
[JSC] Avoid setting unnecessary watchpoints
https://bugs.webkit.org/show_bug.cgi?id=317809
rdar://180580140
Reviewed by Yusuke Suzuki.
AbstractInterpreter registers many structures (Graph::registerStructure)
and this sets many CodeBlockJettisoningWatchpoints eagerly. This
jettisons CodeBlocks in cases when the emitted code doesn't speculate on
the watchpoint being set, which is wasteful.
Change the DFG to explicitly watch structures with tryWatch or watch and
don't eagerly set the watchpoint in registerStructure. Also rename
dfgShouldWatch to dfgMayWatch and a few other things to reflect this.
Before this change, we called dfgShouldWatch after registerStructure to
know that we already set the watchpoint. After this change, we need to
check the result of tryWatch or isWatched or call watch to know that the
watchpoint has been set.
Note that after this change, we can still set watchpoints that are not
needed for the emitted code; to avoid this, we'd need to keep track of
which abstract values would need to set watchpoints to be trusted and
only set those watchpoints when trusting the abstract value enables
emitting better code.
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::noteDFGWatchedStructure):
(JSC::CodeBlock::~CodeBlock):
(JSC::CodeBlock::jettison):
* Source/JavaScriptCore/bytecode/CodeBlock.h:
* Source/JavaScriptCore/bytecode/Watchpoint.h:
(JSC::FireDetail::watchpointStructure const):
* Source/JavaScriptCore/dfg/DFGAbstractValue.cpp:
(JSC::DFG::AbstractValue::set):
(JSC::DFG::AbstractValue::fastForwardToAndFilterSlow):
(JSC::DFG::AbstractValue::fastForwardToSlow):
* Source/JavaScriptCore/dfg/DFGAbstractValue.h:
(JSC::DFG::AbstractValue::clobberStructures):
(JSC::DFG::AbstractValue::fastForwardFromTo):
(JSC::DFG::AbstractValue::fastForwardTo):
(JSC::DFG::AbstractValue::fastForwardToAndFilterUnproven):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::planLoad):
* Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck):
* Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp:
(JSC::DFG::DesiredWatchpoints::processNonLoadBearingStructureTransitions):
* Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.h:
(JSC::DFG::DesiredWatchpoints::addPotentiallyWatchedTransition):
(JSC::DFG::DesiredWatchpoints::isPotentiallyWatchedTransition const):
(JSC::DFG::DesiredWatchpoints::takePotentiallyWatchedTransition):
* Source/JavaScriptCore/dfg/DFGGraph.cpp:
(JSC::DFG::Graph::promoteToConstant):
(JSC::DFG::Graph::tryGetConstantProperty):
(JSC::DFG::Graph::registerStructure):
(JSC::DFG::Graph::registerStructureAndTryWatch):
(JSC::DFG::Graph::tryWatch):
(JSC::DFG::Graph::watch):
(JSC::DFG::Graph::isWatched):
(JSC::DFG::Graph::assertIsRegistered):
(JSC::DFG::Graph::registerAndWatchStructureTransition): Deleted.
* Source/JavaScriptCore/dfg/DFGGraph.h:
* Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::endBasicBlock):
* Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.h:
(JSC::DFG::InPlaceAbstractState::fastForward):
(JSC::DFG::InPlaceAbstractState::fastForwardAndFilterUnproven):
* Source/JavaScriptCore/dfg/DFGPlan.cpp:
(JSC::DFG::Plan::finalizeInThread):
* Source/JavaScriptCore/dfg/DFGStructureAbstractValue.cpp:
(JSC::DFG::StructureAbstractValue::clobber):
* Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h:
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/runtime/Structure.h:
Canonical link: https://commits.webkit.org/316084@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications