Title: [145143] trunk/Source/_javascript_Core
- Revision
- 145143
- Author
- [email protected]
- Date
- 2013-03-07 15:11:22 -0800 (Thu, 07 Mar 2013)
Log Message
The DFG fixpoint is not strictly profitable, and should be straight-lined
https://bugs.webkit.org/show_bug.cgi?id=111764
Reviewed by Oliver Hunt and Geoffrey Garen.
The DFG previously ran optimizations to fixpoint because there exists a circular dependency:
CSE depends on CFG simplification: CFG simplification merges blocks, and CSE is block-local.
CFG simplification depends on CFA and constant folding: constant folding reveals branches on
constants.
CFA depends on CSE: CSE reveals must-alias relationships by proving that two operations
always produce identical values.
Arguments simplification also depends on CSE, but it ought not depend on anything else.
Hence we get a cycle like: CFA -> folding -> CFG -> CSE -> CFA.
Note that before we had sparse conditional CFA, we also had CFA depending on CFG. This ought
not be the case anymore: CFG simplification should not by itself lead to better CFA results.
My guess is that the weakest link in this cycle is CFG -> CSE. CSE cuts both ways: if you
CSE too much then you increase register pressure. Hence it's not clear that you always want
to CSE after simplifying control flow. This leads to an order of optimization as follows:
CSE -> arguments -> CFA -> folding -> CFG
This is a 2.5% speed-up on SunSpider, a 4% speed-up on V8Spider, a possible 0.3% slow-down
on V8v7, nothing on Kraken, and 1.2% speed-up in the JSRegress geomean. I'll take a 2.5%
speed-up over a 0.3% V8v7 speed-up.
* dfg/DFGDriver.cpp:
(JSC::DFG::compile):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (145142 => 145143)
--- trunk/Source/_javascript_Core/ChangeLog 2013-03-07 22:52:59 UTC (rev 145142)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-03-07 23:11:22 UTC (rev 145143)
@@ -1,3 +1,40 @@
+2013-03-07 Filip Pizlo <[email protected]>
+
+ The DFG fixpoint is not strictly profitable, and should be straight-lined
+ https://bugs.webkit.org/show_bug.cgi?id=111764
+
+ Reviewed by Oliver Hunt and Geoffrey Garen.
+
+ The DFG previously ran optimizations to fixpoint because there exists a circular dependency:
+
+ CSE depends on CFG simplification: CFG simplification merges blocks, and CSE is block-local.
+
+ CFG simplification depends on CFA and constant folding: constant folding reveals branches on
+ constants.
+
+ CFA depends on CSE: CSE reveals must-alias relationships by proving that two operations
+ always produce identical values.
+
+ Arguments simplification also depends on CSE, but it ought not depend on anything else.
+
+ Hence we get a cycle like: CFA -> folding -> CFG -> CSE -> CFA.
+
+ Note that before we had sparse conditional CFA, we also had CFA depending on CFG. This ought
+ not be the case anymore: CFG simplification should not by itself lead to better CFA results.
+
+ My guess is that the weakest link in this cycle is CFG -> CSE. CSE cuts both ways: if you
+ CSE too much then you increase register pressure. Hence it's not clear that you always want
+ to CSE after simplifying control flow. This leads to an order of optimization as follows:
+
+ CSE -> arguments -> CFA -> folding -> CFG
+
+ This is a 2.5% speed-up on SunSpider, a 4% speed-up on V8Spider, a possible 0.3% slow-down
+ on V8v7, nothing on Kraken, and 1.2% speed-up in the JSRegress geomean. I'll take a 2.5%
+ speed-up over a 0.3% V8v7 speed-up.
+
+ * dfg/DFGDriver.cpp:
+ (JSC::DFG::compile):
+
2013-03-07 Roger Fong <[email protected]>
Build fix for AppleWin VS2010.
Modified: trunk/Source/_javascript_Core/dfg/DFGDriver.cpp (145142 => 145143)
--- trunk/Source/_javascript_Core/dfg/DFGDriver.cpp 2013-03-07 22:52:59 UTC (rev 145142)
+++ trunk/Source/_javascript_Core/dfg/DFGDriver.cpp 2013-03-07 23:11:22 UTC (rev 145143)
@@ -126,34 +126,19 @@
performFixup(dfg);
performStructureCheckHoisting(dfg);
- unsigned cnt = 1;
dfg.m_fixpointState = FixpointNotConverged;
- for (;; ++cnt) {
- if (logCompilationChanges())
- dataLogF("DFG beginning optimization fixpoint iteration #%u.\n", cnt);
- bool changed = false;
-
- if (validationEnabled())
- validate(dfg);
-
- performCFA(dfg);
- changed |= performConstantFolding(dfg);
- changed |= performArgumentsSimplification(dfg);
- changed |= performCFGSimplification(dfg);
- changed |= performCSE(dfg);
-
- if (!changed)
- break;
-
- performCPSRethreading(dfg);
- }
-
- if (logCompilationChanges())
- dataLogF("DFG optimization fixpoint converged in %u iterations.\n", cnt);
+ performCSE(dfg);
+ performArgumentsSimplification(dfg);
+ performCPSRethreading(dfg); // This should usually be a no-op since CSE rarely dethreads, and arguments simplification rarely does anything.
+ performCFA(dfg);
+ performConstantFolding(dfg);
+ performCFGSimplification(dfg);
+
dfg.m_fixpointState = FixpointConverged;
+
performStoreElimination(dfg);
- performCPSRethreading(dfg); // This should usually be a no-op since store elimination rarely dethreads the graph.
+ performCPSRethreading(dfg);
performDCE(dfg);
performVirtualRegisterAllocation(dfg);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes