Skip to content

Commit 001eb86

Browse files
author
Filip Pizlo
committed
B3::fixSSA() needs a tune-up
https://bugs.webkit.org/show_bug.cgi?id=170485 Reviewed by Saam Barati. Source/JavaScriptCore: After the various optimizations to liveness, register allocation, and other phases, the fixSSA() phase now looks like one of the top offenders. This includes a bunch of changes to make this phase run faster. This is a ~7% wasm -O1 compile time progression. Here's what I did: - We now use IndexSparseSet instead of IndexMap for tracking variable values. This makes it cheaper to chew through small blocks while there is a non-trivial number of total variables. - We now do a "local SSA conversion" pass before anything else. This eliminates obvious Get's. If we were using temporary Variables, it would eliminate many of those. That's useful for when we use demoteValues() and duplciateTails(). For wasm -O1, we mainly care about the fact that it makes a bunch of Set's dead. - We now do a Set DCE pass after the local SSA but before SSA conversion. This ensures that any block-local live intervals of Variables disappear and don't need further consideration. - We now cache the reaching defs calculation. - We now perform the reaching defs calculation lazily. * b3/B3FixSSA.cpp: (JSC::B3::demoteValues): (JSC::B3::fixSSA): * b3/B3SSACalculator.cpp: (JSC::B3::SSACalculator::reachingDefAtTail): * b3/B3VariableLiveness.cpp: (JSC::B3::VariableLiveness::VariableLiveness): * b3/air/AirLiveness.h: (JSC::B3::Air::Liveness::Liveness): * dfg/DFGLivenessAnalysisPhase.cpp: (JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): Deleted. (JSC::DFG::LivenessAnalysisPhase::run): Deleted. (JSC::DFG::LivenessAnalysisPhase::processBlock): Deleted. Source/WTF: This makes IndexSparseSet capable of being used as a map if you instantiate it with KeyValuePair<unsigned, ValueType>. * wtf/HashTraits.h: * wtf/IndexSparseSet.h: (WTF::DefaultIndexSparseSetTraits::create): (WTF::DefaultIndexSparseSetTraits::key): (WTF::OverflowHandler>::IndexSparseSet): (WTF::OverflowHandler>::add): (WTF::OverflowHandler>::set): (WTF::OverflowHandler>::remove): (WTF::OverflowHandler>::clear): (WTF::OverflowHandler>::size): (WTF::OverflowHandler>::isEmpty): (WTF::OverflowHandler>::contains): (WTF::OverflowHandler>::sort): (WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet): Deleted. (WTF::IndexSparseSet<OverflowHandler>::add): Deleted. (WTF::IndexSparseSet<OverflowHandler>::remove): Deleted. (WTF::IndexSparseSet<OverflowHandler>::clear): Deleted. (WTF::IndexSparseSet<OverflowHandler>::size): Deleted. (WTF::IndexSparseSet<OverflowHandler>::isEmpty): Deleted. (WTF::IndexSparseSet<OverflowHandler>::contains): Deleted. (WTF::IndexSparseSet<OverflowHandler>::sort): Deleted. * wtf/Liveness.h: (WTF::Liveness::LocalCalc::Iterable::iterator::iterator): (WTF::Liveness::workset): Canonical link: https://commits.webkit.org/187401@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214917 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 4f8051c commit 001eb86

10 files changed

Lines changed: 388 additions & 142 deletions

File tree

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
2017-04-04 Filip Pizlo <fpizlo@apple.com>
2+
3+
B3::fixSSA() needs a tune-up
4+
https://bugs.webkit.org/show_bug.cgi?id=170485
5+
6+
Reviewed by Saam Barati.
7+
8+
After the various optimizations to liveness, register allocation, and other phases, the
9+
fixSSA() phase now looks like one of the top offenders. This includes a bunch of
10+
changes to make this phase run faster. This is a ~7% wasm -O1 compile time progression.
11+
12+
Here's what I did:
13+
14+
- We now use IndexSparseSet instead of IndexMap for tracking variable values. This
15+
makes it cheaper to chew through small blocks while there is a non-trivial number of
16+
total variables.
17+
18+
- We now do a "local SSA conversion" pass before anything else. This eliminates
19+
obvious Get's. If we were using temporary Variables, it would eliminate many of
20+
those. That's useful for when we use demoteValues() and duplciateTails(). For wasm
21+
-O1, we mainly care about the fact that it makes a bunch of Set's dead.
22+
23+
- We now do a Set DCE pass after the local SSA but before SSA conversion. This ensures
24+
that any block-local live intervals of Variables disappear and don't need further
25+
consideration.
26+
27+
- We now cache the reaching defs calculation.
28+
29+
- We now perform the reaching defs calculation lazily.
30+
31+
* b3/B3FixSSA.cpp:
32+
(JSC::B3::demoteValues):
33+
(JSC::B3::fixSSA):
34+
* b3/B3SSACalculator.cpp:
35+
(JSC::B3::SSACalculator::reachingDefAtTail):
36+
* b3/B3VariableLiveness.cpp:
37+
(JSC::B3::VariableLiveness::VariableLiveness):
38+
* b3/air/AirLiveness.h:
39+
(JSC::B3::Air::Liveness::Liveness):
40+
* dfg/DFGLivenessAnalysisPhase.cpp:
41+
(JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase): Deleted.
42+
(JSC::DFG::LivenessAnalysisPhase::run): Deleted.
43+
(JSC::DFG::LivenessAnalysisPhase::processBlock): Deleted.
44+
145
2017-04-04 Joseph Pecoraro <pecoraro@apple.com>
246

347
Remove stale LLVM Header Path includes from JavaScriptCore

0 commit comments

Comments
 (0)