Closed
Bug 470721
Opened 16 years ago
Closed 15 years ago
TM: Constant-fold builtin calls by calling them at compile time if the required arguments are constant
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: Waldo, Assigned: n.nethercote)
Details
No description provided.
Updated•16 years ago
|
Summary: TM: Don't emit insCall(&js_EqualStrings_ci, args) if the two values being compared are pointer-equal → TM: Constant-fold builtin calls by calling them at compile time if the required arguments are constant
Comment 1•16 years ago
|
||
Some arguments don't have to be constant like cx, so this needs some additional meta-data and we have to generate some wrapper code from the table that knows how to call the functions.
Updated•15 years ago
|
Assignee: general → nnethercote
Comment 2•15 years ago
|
||
This is a pretty straight forward isolated change to nanojit. Probably requires some macrologic magic to evaluate the builtin at recording time. Nominating Nick for the bug if he is interested :) (toss back in the pool if not)
Assignee | ||
Comment 4•15 years ago
|
||
I looked into this a bit. My conclusion is that there's not much to be gained from this. The obvious place to do the constant folding is in jstracer.cpp:FuncFilter::insCall(). It already has cases for js_DoubleToInt32, js_DoubleToUint32, js_BoxDouble, doing not just simple folding when the args are constant, but also some folding of call chains (eg. BoxDouble(UnboxDouble(x)) == x. I looked at the frequencies of the calls coming through this function. The three functions above that are already handled dominate, eg. for V8 they account for 2/3 of the static occurrences. Then there are the ones that aren't suitable for folding, such as js_FastNewObject and js_FastNewArray. And of the ones that are suitable and not already handled, extremely few actually have constant args, ie. few enough that I had real trouble even finding a test case to trigger the constant folding. (Nb: js_imod and js_dmod seemed like good candidates, but I couldn't get them to have constant args at all, maybe they are folded somewhere else?) Not being able to trigger many of them, I'm extremely reluctant to apply a blanket macro-based folding process -- it's likely to be buggy due to the lack of testing. And I think that the most important cases are already handled, and if any more come up (doesn't seem likely it'll be more than one or two) they can be easily added by hand to FuncFilter::insCall(), and that can include any chain-of-call ones.
Assignee | ||
Updated•15 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•