DFG should inline code blocks that use scoped variable access
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2012 20:25:24 +0000 (20:25 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2012 20:25:24 +0000 (20:25 +0000)
commitb3b83cd752a5f42f963e2de427091ffb3c1ee453
tree89d8e18ef6e61440ea5855b52e2f93df37af0d56
parentc27ad80cceea02913e92a2487ddfbe3f0776659a
DFG should inline code blocks that use scoped variable access
https://bugs.webkit.org/show_bug.cgi?id=103974

Reviewed by Oliver Hunt.

This mostly just turns on something we could have done all along, but also adds a few key
necessities to make this right:

1) Constant folding of SkipScope, since if we inline with a known JSFunction* then the
   scope is constant.

2) Interference analysis for GetLocal<->PutScopedVar and SetLocal<->GetScopedVar.

This is not meant to be a speed-up on major benchmarks since we don't yet inline most
closure calls for entirely unrelated reasons. But on toy programs it can be >2x faster.

* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::execute):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::getScope):
(JSC::DFG::ByteCodeParser::parseResolveOperations):
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::scopedVarLoadElimination):
(JSC::DFG::CSEPhase::scopedVarStoreElimination):
(JSC::DFG::CSEPhase::getLocalLoadElimination):
(JSC::DFG::CSEPhase::setLocalStoreElimination):
* dfg/DFGCapabilities.h:
(JSC::DFG::canInlineResolveOperations):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGAbstractState.cpp
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
Source/JavaScriptCore/dfg/DFGCSEPhase.cpp
Source/JavaScriptCore/dfg/DFGCapabilities.h