The recursive tail call optimisation is wrong on closures
authorrmorisset@apple.com <rmorisset@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 17:31:54 +0000 (17:31 +0000)
committerrmorisset@apple.com <rmorisset@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 17:31:54 +0000 (17:31 +0000)
commit2e044440de60c5845b49e2af33f294d7961c9293
treedc13fc65ae60f17e712f4aa045e849df5e6e5fb2
parent50b4814c14b0a8c77671707aa84d60566961fffa
The recursive tail call optimisation is wrong on closures
https://bugs.webkit.org/show_bug.cgi?id=179835

Reviewed by Saam Barati.

JSTests:

* stress/closure-recursive-tail-call.js: Added.
(makeClosure):

PerformanceTests:

This new benchmark is a very close variant of the merge-sort benchmark, that writes mergeSorted in a kinda CPS style,
to stress the use of closures, and of polymorphic calls.

* TailBench9000/merge-sort-cps.js: Added.
(createRNG):
(mergeSorted):
(checkSorted.check):
(add):
(build):
(compare):
(checkSpectrum):
(buildArray):
(test):

Source/JavaScriptCore:

The problem is that we only check the executable of the callee, not whatever variables might have been captured.
As a stopgap measure this patch just does not do the optimisation for closures.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleRecursiveTailCall):

Tools:

This just includes merge-sort-cps.js to the list of benchmarks ran by run-jsc-benchmarks --tail-bench

* Scripts/run-jsc-benchmarks:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/closure-recursive-tail-call.js [new file with mode: 0644]
PerformanceTests/ChangeLog
PerformanceTests/TailBench9000/merge-sort-cps.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
Tools/ChangeLog
Tools/Scripts/run-jsc-benchmarks