The Problem of Numbers
One of the hardest bits to get right in a dynamic language is how to handle numbers. In Smalltalk, small numbers are typically stored as integers inside a pointer, with the lowest bit set to 1 to flag them as not being real objects. (The lowest bit in an object pointer is always 0, because objects are word-aligned.) The ECMAScript specification makes things a bit more difficult. Numbers in ECMAScript have to have the range and precision of a 64-bit floating-point value.
If you're really clever, you can avoid some of these tests. If you have a loop variable, for example, often you can guarantee its range. Consider a loop statement like this:
for (i = 1 ; i<100 ; i++)
If i isn't written to anywhere in the loop, you can guarantee that the increment will never overflow, and you can guarantee that i will always be an integer. This kind of type analysis can be extended to cover a lot of cases. The more you can eliminate, the faster the code will run.