I don't know if it works (as I never tried it myself), but perhaps you
could use compileFunction(see API for params), which is a method of
Context objects and returns a Function object.
Using that Function object you then can call call(again see API for
It's possible to set parameters to the function you want to call.
Hope, this is useful to you!
P.S. The Rhino- newsgroup switched to mozilla.dev.tech.js-engine. In
order to get your postings read, you should think about a switch, too