> If you just analyze the current piece of code, you will miss out on a lot of potential optimizations.
I didn't say that you only analyze the current piece of code. Type inference is, by nature, a global optimization. However, you don't do it until you've identified the hot spots, and you've established that it's worth investing time into it.
First, however, you get something quick running so that there are no delays, and the cost doesn't matter much to the user.
In any case, this is far from low-hanging fruit. It's very difficult to to properly, so it isn't surprising that this is the first mainstream JS engine to do it. It began as a research project - it wasn't clear it would ever end up succeeding at all.
I didn't say that you only analyze the current piece of code. Type inference is, by nature, a global optimization. However, you don't do it until you've identified the hot spots, and you've established that it's worth investing time into it.
First, however, you get something quick running so that there are no delays, and the cost doesn't matter much to the user.