on master help sign in
javascript: remove redundant continuations
commit88e58234ed020d206827d614f4f483194341d0d7 authorraichoo <raichoo@googlemail.com> dateMon 3 Feb 2014, 00:42 (13 years ago) parent4070d2b
1 file changed+12
src/IRTS/CodegenJavaScript.hs+12
src/IRTS/CodegenJavaScript.hs+12
@@ -666,6 +666,17 @@ inlineFunctions js =
666666 | otherwise = 0
667667
668668
669+reduceContinuations :: JS -> JS
670+reduceContinuations = transformJS reduceHelper
671+ where
672+ reduceHelper :: JS -> JS
673+ reduceHelper (JSNew "__IDRRT__Cont" [JSFunction [] (
674+ JSReturn js@(JSNew "__IDRRT__Cont" [JSFunction [] body])
675+ )]) = js
676+
677+ reduceHelper js = transformJS reduceHelper js
678+
679+
669680reduceConstant :: JS -> JS
670681reduceConstant
671682 (JSApp (JSIdent "__IDRRT__tailcall") [JSFunction [] (
@@ -853,6 +864,7 @@ codegenJavaScript target definitions filename outputType = do
853864 , map (optimizeEvalTailcalls ("__IDR__mAPPLY0", "__IDRRT__APPLYTC"))
854865 , map removeInstanceChecks
855866 , inlineFunctions
867+ , map reduceContinuations
856868 ]
857869
858870