Avoid dynamic use of Runtime.addFunction
Fix SharedWorker detection
Optimization fixes