Hi Igor, On 07/09/2012 12:02 PM, Igor Rafael wrote:
I would like to know if there is a way to check if a JS function is recursive before any JIT compilation.
We run the script analysis before compiling each script. I don't know if there is a mean to run an analysis on all scripts but I guess this is not practical in terms of memory.
I have noticed, for instance, that there is a file named "jsanalyze.cpp" that traverses the bytecode to gather useful information about the script, but I have not found anything about recursive calls there.
You might be able to detect some direct recursion by looking at singleton functions of calls and deduce that the function is recursive.
Currently, we run the type inference analysis before compiling and before inlining. So if you have function which are only mutually recursive, we might not be able to detect it until we inline all other functions.
You might want to monitor the frequent callers of each script to determine if the script might be recursive or not. In addition, this might be a good hint for inlining if there is only one caller.
-- Nicolas B. Pierron _______________________________________________ dev-tech-js-engine-internals mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

