v8-internal.h header), but things have become much more complex. For example, V8 also uses pointer tags to encode garbage collection information. And in contradiction to what I said in the first paragraph, V8 also tags fields within objects with a type.
At least within a function, you can assume that the JS engine will be able to infer a type for each variable, either through analysis of the surrounding code or speculatively. Such information can be used to JIT-compile efficient code for the function, allowing data to be processed without having to consider type tags for each operation.