on master help sign in
javascript: reduce tailcalls for reduced functions
commit0efe2157a262a2d6ee8b621d1aa199426988e4e0 authorraichoo <raichoo@googlemail.com> dateThu 10 Oct 2013, 21:50 (13 years ago) parent8947a2e
1 file changed+5
src/IRTS/CodegenJavaScript.hs+5
src/IRTS/CodegenJavaScript.hs+5
@@ -353,6 +353,11 @@ reduceJS program =
353353 funNames _ = error "WTF?"
354354
355355 reduceCall :: [String] -> JS -> JS
356+ reduceCall funs (JSApp (JSRaw "__IDRRT__tailcall") [JSFunction [] (
357+ JSReturn (JSApp (JSRaw ret) [])
358+ )])
359+ | ret `elem` funs = JSRaw ret
360+
356361 reduceCall funs js@(JSApp (JSRaw fun) [])
357362 | fun `elem` funs = JSRaw fun
358363 | otherwise = js