JavaScript compilers (in the sense of Java->JavaScript, not V8/TraceMonkey) already do this. Surprisingly inlining can help quite a bit in JS; due to how JS is "specified", there is extremely little room for interpreters to perform optimizations. Inlining code can save browsers from having to do lots of lookups and dereferences to functions in tight loops.
Scheme2JS, ocamljs, haxe, and others all do inlining. The code size gets a little bit larger, but if you have actual performance problems in loops, it can be worth it. Minify-ing and zip usually make JS code sizes trivial anyway.