Title: [291026] trunk
- Revision
- 291026
- Author
- [email protected]
- Date
- 2022-03-08 18:53:09 -0800 (Tue, 08 Mar 2022)
Log Message
Enable tier-up in loops created by recursive tail call optimizations.
https://bugs.webkit.org/show_bug.cgi?id=178389
Reviewed by Saam Barati.
PerformanceTests:
Just changed a constant for consistency with TailBench9000/merge-sort.js
* TailBench9000/merge-sort-cps.js:
Source/_javascript_Core:
Made the recursive tail call optimization only run in FTL mode, since it is a significant progression on TailBench.
Also some trivial refactoring of handleRecursiveTailCall.
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
Modified Paths
Diff
Modified: trunk/PerformanceTests/ChangeLog (291025 => 291026)
--- trunk/PerformanceTests/ChangeLog 2022-03-09 02:25:17 UTC (rev 291025)
+++ trunk/PerformanceTests/ChangeLog 2022-03-09 02:53:09 UTC (rev 291026)
@@ -1,3 +1,14 @@
+2022-03-08 Robin Morisset <[email protected]>
+
+ Enable tier-up in loops created by recursive tail call optimizations.
+ https://bugs.webkit.org/show_bug.cgi?id=178389
+
+ Reviewed by Saam Barati.
+
+ Just changed a constant for consistency with TailBench9000/merge-sort.js
+
+ * TailBench9000/merge-sort-cps.js:
+
2022-03-01 Yusuke Suzuki <[email protected]>
Fix Speedometer's setTimeout throttling issue
Modified: trunk/PerformanceTests/TailBench9000/merge-sort-cps.js (291025 => 291026)
--- trunk/PerformanceTests/TailBench9000/merge-sort-cps.js 2022-03-09 02:25:17 UTC (rev 291025)
+++ trunk/PerformanceTests/TailBench9000/merge-sort-cps.js 2022-03-09 02:53:09 UTC (rev 291026)
@@ -131,7 +131,7 @@
let arrays = [
buildArray(10, x => x),
buildArray(10, x => -x),
- buildArray(1000, x => random())
+ buildArray(10000, x => random())
];
function test(index)
Modified: trunk/Source/_javascript_Core/ChangeLog (291025 => 291026)
--- trunk/Source/_javascript_Core/ChangeLog 2022-03-09 02:25:17 UTC (rev 291025)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-03-09 02:53:09 UTC (rev 291026)
@@ -1,3 +1,16 @@
+2022-03-08 Robin Morisset <[email protected]>
+
+ Enable tier-up in loops created by recursive tail call optimizations.
+ https://bugs.webkit.org/show_bug.cgi?id=178389
+
+ Reviewed by Saam Barati.
+
+ Made the recursive tail call optimization only run in FTL mode, since it is a significant progression on TailBench.
+ Also some trivial refactoring of handleRecursiveTailCall.
+
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
+
2022-03-08 Saam Barati <[email protected]>
[JSC] Enable ThinLTO
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (291025 => 291026)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2022-03-09 02:25:17 UTC (rev 291025)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2022-03-09 02:53:09 UTC (rev 291026)
@@ -1467,6 +1467,11 @@
if (UNLIKELY(!Options::optimizeRecursiveTailCalls()))
return false;
+ // This optimisation brings more performance if it only runs in FTL, probably because it interferes with tier-up.
+ // See https://bugs.webkit.org/show_bug.cgi?id=178389 for details.
+ if (!isFTL(m_graph.m_plan.mode()))
+ return false;
+
auto targetExecutable = callVariant.executable();
InlineStackEntry* stackEntry = m_inlineStackTop;
do {
@@ -1488,6 +1493,10 @@
// a good target to jump into.
if (callFrame->isVarargs())
continue;
+ // If an InlineCallFrame is not a closure, it was optimized using a constant callee.
+ // Check if this is the same callee that we are dealing with.
+ if (!callFrame->isClosureCall && callFrame->calleeConstant() != callVariant.function())
+ continue;
} else {
// We are in the machine code entry (i.e. the original caller).
// If we have more arguments than the number of parameters to the function, it is not clear where we could put them on the stack.
@@ -1495,13 +1504,6 @@
return false;
}
- // If an InlineCallFrame is not a closure, it was optimized using a constant callee.
- // Check if this is the same callee that we try to inline here.
- if (stackEntry->m_inlineCallFrame && !stackEntry->m_inlineCallFrame->isClosureCall) {
- if (stackEntry->m_inlineCallFrame->calleeConstant() != callVariant.function())
- continue;
- }
-
// We must add some check that the profiling information was correct and the target of this call is what we thought.
emitFunctionCheckIfNeeded();
// We flush everything, as if we were in the backedge of a loop (see treatment of op_jmp in parseBlock).
@@ -1508,12 +1510,12 @@
flushForTerminal();
// We must set the callee to the right value
- if (stackEntry->m_inlineCallFrame) {
- if (stackEntry->m_inlineCallFrame->isClosureCall)
- setDirect(remapOperand(stackEntry->m_inlineCallFrame, CallFrameSlot::callee), callTargetNode, NormalSet);
- } else
+ if (!stackEntry->m_inlineCallFrame)
addToGraph(SetCallee, callTargetNode);
+ else if (stackEntry->m_inlineCallFrame->isClosureCall)
+ setDirect(remapOperand(stackEntry->m_inlineCallFrame, CallFrameSlot::callee), callTargetNode, NormalSet);
+
// We must set the arguments to the right values
if (!stackEntry->m_inlineCallFrame)
addToGraph(SetArgumentCountIncludingThis, OpInfo(argumentCountIncludingThis));
@@ -1550,7 +1552,6 @@
// It would be unsound to jump over a non-tail call: the "tail" call is not really a tail call in that case.
} while (stackEntry->m_inlineCallFrame && stackEntry->m_inlineCallFrame->kind == InlineCallFrame::TailCall && (stackEntry = stackEntry->m_caller));
- // The tail call was not recursive
return false;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes