I studied this problem in the lessons about the implementation of programming languages during my master degree, I think it is not a problem, there is no solution, you can use the same variable to store an integer, a string and after that an object of any kind, let’s face it. As a consequence, the automatic memory management has to track all these instances and to know in each context what the expected type is.
I see what you mean but the same kind of people never admitted that Java allocation and method calls could be faster.
It is not that simple. The future JVMs will have some new bytecode instructions specifically for dynamic languages, there are several ways of improving the performances of JavaScript. Anyway, even though JavaScript was twice slower than Java, it would not be a problem for most projects as when Java was twice slower than C, it was not a problem for lots of projects.