سؤال

this is a very simple question that i cannot seem to find answers for:

Are javascript engines such as chromes V8 and Internet Explorers Chakra (in EI9+) similar in function to virtual machines for languages such as Java?

هل كانت مفيدة؟

المحلول

Browser interprets and executes the js code directly while for virtual machine executes the byte-code. Java code (a “.java” file) compiled turns into a “.class” file that contains the compiled Java bytecode, which can then be read and understood by the Java Virtual Machine. The JVM, in turn, takes the compiled Java bytecode and then runs, or executes, the code.

نصائح أخرى

Actually, Chakra in IE9 does indeed compile the script code to bytecode and then executes that bytecode (and possibly JITs it) [1]. There are similarities between Javascript Engines and other virtual machines but enough differences because of the dynamic nature of Javascript.

[1] http://blogs.msdn.com/b/ie/archive/2012/06/13/advances-in-javascript-performance-in-ie10-and-windows-8.aspx

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top