on master help sign in
javascript: optimize case for trampolines
commitcaa31939afd37ea2b5d7a66618615df5e03a3278 authorraichoo <raichoo@googlemail.com> dateMon 7 Oct 2013, 20:17 (13 years ago) parentc551412
1 file changed+7
src/IRTS/CodegenJavaScript.hs+7
src/IRTS/CodegenJavaScript.hs+7
@@ -233,6 +233,13 @@ optimizeJS (JSApp (JSFunction [arg] (JSReturn ret)) [val])
233233 JSReturn $ JSApp fun (jsSubst arg vars (optimizeJS val))
234234 )]
235235
236+ | JSApp (JSRaw "__IDRRT__tailcall") [JSFunction [] (
237+ JSReturn (JSApp fun args)
238+ )] <- ret =
239+ JSApp (JSRaw "__IDRRT__tailcall") [JSFunction [] (
240+ JSReturn $ JSApp fun (jsSubst arg args (optimizeJS val))
241+ )]
242+
236243optimizeJS (JSSeq seq) =
237244 JSSeq (map optimizeJS seq)
238245