DFG AI should have O(1) clobbering
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 May 2018 01:05:21 +0000 (01:05 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 May 2018 01:05:21 +0000 (01:05 +0000)
commite94fa6f4beec700107c72e804b3c6794fddce32e
treeee5ae9e817eaca2c370cbf37efb0b0955d73050f
parent3f6013f02c9187b14bcd9e1c33027ae8d34b384c
DFG AI should have O(1) clobbering
https://bugs.webkit.org/show_bug.cgi?id=185287

Reviewed by Saam Barati.
JSTests:

* stress/simple-ai-effect.js: Added.
(bar):
(foo):

Source/JavaScriptCore:

This fixes an old scalability probem in AI. Previously, if we did clobberWorld(), then we
would traverse all of the state available to the AI at that time and clobber it.

This changes clobberWorld() to be O(1). It just does some math to a clobber epoch.

This is a ~1% speed-up for compile times.

* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* dfg/DFGAbstractInterpreter.h:
(JSC::DFG::AbstractInterpreter::forNode):
(JSC::DFG::AbstractInterpreter::setForNode):
(JSC::DFG::AbstractInterpreter::clearForNode):
(JSC::DFG::AbstractInterpreter::variables): Deleted.
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
(JSC::DFG::AbstractInterpreter<AbstractStateType>::clobberWorld):
(JSC::DFG::AbstractInterpreter<AbstractStateType>::forAllValues):
(JSC::DFG::AbstractInterpreter<AbstractStateType>::clobberStructures):
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeDoubleUnaryOpEffects):
* dfg/DFGAbstractValue.cpp:
(JSC::DFG::AbstractValue::fastForwardToSlow):
* dfg/DFGAbstractValue.h:
(JSC::DFG::AbstractValue::fastForwardTo):
(JSC::DFG::AbstractValue::clobberStructuresFor): Deleted.
(JSC::DFG::AbstractValue::observeInvalidationPoint): Deleted.
(JSC::DFG::AbstractValue::observeInvalidationPointFor): Deleted.
* dfg/DFGAbstractValueClobberEpoch.cpp: Added.
(JSC::DFG::AbstractValueClobberEpoch::dump const):
* dfg/DFGAbstractValueClobberEpoch.h: Added.
(JSC::DFG::AbstractValueClobberEpoch::AbstractValueClobberEpoch):
(JSC::DFG::AbstractValueClobberEpoch::first):
(JSC::DFG::AbstractValueClobberEpoch::clobber):
(JSC::DFG::AbstractValueClobberEpoch::observeInvalidationPoint):
(JSC::DFG::AbstractValueClobberEpoch::operator== const):
(JSC::DFG::AbstractValueClobberEpoch::operator!= const):
(JSC::DFG::AbstractValueClobberEpoch::structureClobberState const):
(JSC::DFG::AbstractValueClobberEpoch::clobberEpoch const):
* dfg/DFGAtTailAbstractState.h:
(JSC::DFG::AtTailAbstractState::setForNode):
(JSC::DFG::AtTailAbstractState::clearForNode):
(JSC::DFG::AtTailAbstractState::numberOfArguments const):
(JSC::DFG::AtTailAbstractState::numberOfLocals const):
(JSC::DFG::AtTailAbstractState::operand):
(JSC::DFG::AtTailAbstractState::local):
(JSC::DFG::AtTailAbstractState::argument):
(JSC::DFG::AtTailAbstractState::clobberStructures):
(JSC::DFG::AtTailAbstractState::observeInvalidationPoint):
(JSC::DFG::AtTailAbstractState::variables): Deleted.
* dfg/DFGCFAPhase.cpp:
(JSC::DFG::CFAPhase::performBlockCFA):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* dfg/DFGFlowMap.h:
(JSC::DFG::FlowMap::at):
(JSC::DFG::FlowMap::atShadow):
(JSC::DFG::FlowMap::at const):
(JSC::DFG::FlowMap::atShadow const):
* dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::beginBasicBlock):
(JSC::DFG::InPlaceAbstractState::endBasicBlock):
* dfg/DFGInPlaceAbstractState.h:
(JSC::DFG::InPlaceAbstractState::forNode):
(JSC::DFG::InPlaceAbstractState::setForNode):
(JSC::DFG::InPlaceAbstractState::clearForNode):
(JSC::DFG::InPlaceAbstractState::variablesForDebugging):
(JSC::DFG::InPlaceAbstractState::numberOfArguments const):
(JSC::DFG::InPlaceAbstractState::numberOfLocals const):
(JSC::DFG::InPlaceAbstractState::operand):
(JSC::DFG::InPlaceAbstractState::local):
(JSC::DFG::InPlaceAbstractState::argument):
(JSC::DFG::InPlaceAbstractState::variableAt):
(JSC::DFG::InPlaceAbstractState::clobberStructures):
(JSC::DFG::InPlaceAbstractState::observeInvalidationPoint):
(JSC::DFG::InPlaceAbstractState::fastForward):
(JSC::DFG::InPlaceAbstractState::variables): Deleted.
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetStack):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231471 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
JSTests/ChangeLog
JSTests/stress/simple-ai-effect.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/Sources.txt
Source/JavaScriptCore/bytecode/Operands.h
Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h
Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
Source/JavaScriptCore/dfg/DFGAbstractValue.cpp
Source/JavaScriptCore/dfg/DFGAbstractValue.h
Source/JavaScriptCore/dfg/DFGAbstractValueClobberEpoch.cpp [new file with mode: 0644]
Source/JavaScriptCore/dfg/DFGAbstractValueClobberEpoch.h [new file with mode: 0644]
Source/JavaScriptCore/dfg/DFGAtTailAbstractState.h
Source/JavaScriptCore/dfg/DFGCFAPhase.cpp
Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
Source/JavaScriptCore/dfg/DFGFlowMap.h
Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.cpp
Source/JavaScriptCore/dfg/DFGInPlaceAbstractState.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp