I'm not sure why this would reduce memory consumption in V8 -- naturally, V8's parser already disregards comments and whitespace, like any JS engine would.
So I would say the right place for such functionality is a minifier/"uglifier" script that developers can run over their code before shipping it on the web. That way, it also reduces download size. Many such minifiers exist already.
Looking at the details of your plan, two issues come to mind:
(1) Removing newlines from JavaScript is generally not semantics-preserving due to the language's "automatic semicolon insertion" feature.
(2) Regular expressions cannot reliably detect comments in JavaScript, because the language's syntax is more complex than regular expressions can handle. Detecting comments in JS requires a tokenizer that's aware of JS semantics.