not sure how you solve this, does asm.js also cover the regex engine?
I'm compiling a whole perl binary to WebAssembly, including the regex engine and everything. I haven't gotten very far on porting Perl's test suite yet, because it makes use of some of the stuff that isn't supported (e.g. qx and signals), but the tests I was able to run have looked good so far.
patching B::Deparse to emit native JS should be possible
That's an interesting idea, and perhaps something I could think about is how to optimize code like the example I showed on the website:
js('document')->getElementById('my_button')
->addEventListener('click', sub {
js('window')->alert("You clicked the button!");
} );
Running that invokes the JS/Perl glue three times (five if the callback is called), which isn't super efficient at the moment because it does a lot with strings and eval. One possible way to optimize that might be if there was a way to convert at least the first few method calls to
js('document.getElementById("my_button").addEventListener("click",func
+tion(){...})');