V8, the JavaScript engine for Chrome and Node.js, uses Just-In-Time (JIT) compilation to convert code into machine code at runtime for faster execution. It also performs optimizations like inlining, hidden classes, and optimizing memory usage to enhance performance.