2 ms·
I never said it doesn't run in a VM. JavaScript is not bytecode. When the code is run, I grant you that you that the JIT will compile to some sort of bytecode.
by chris_wot 14y ago
I never said it doesn't run in a VM. JavaScript is not bytecode. When the code is run, I grant you that you that the JIT will compile to some sort of bytecode. But you can't take that bytecode and run it under any virtual machine.
As for bytecode "running faster", that's entirely up to the JVM implementation. Given a feature complete JavaScript bytecode, I don't see why a JVM needs to be faster than the JavaScript VM.
You may be conflating the JIT nature of JavaScript vs fully compiled Java apps. With JavaScript, it interprets (even compiles) as it gets the JavaScript code, whereas Java code is already compiled into bytecode.
- qznc 14y agoThe V8 engine [0] compiles Javascript to assembly. Maybe it uses some other intermediate representation internally, maybe not. Why would you want to use bytecode for some random VM as internal representation? You can run Javascript anywhere [1], why would you want to compile it to some portable bytecode? [0] http://en.wikipedia.org/wiki/V8_(JavaScript_engine) http://en.wikipedia.org/wiki/V8_(JavaScript_engine) [1] Well, there are restrictions, just like there are for Java Bytecode.
- chris_wot 14y agoThe original poster wrote "JavaScript is the standard bytecode". That's what I was responding to.