How is Javascript translated to bytecode?

前端 未结 5 1319
滥情空心
滥情空心 2020-12-16 11:30

I can\'t find information on the web how W3C languages compile to machine code. I know that the gap between the web and the processor must be somehow the browser, but how do

5条回答
  •  孤街浪徒
    2020-12-16 12:07

    Javascript (as it's name suggests) is a dynamic scripting language. Meaning that it's code is analysed and executed at runtime by the web-browser's Javascript engine.

    It is up to the Web-browser, how it wants to deal with Javascript. Some may generate an intermediate language, or bytecode. Some may directly analyse and execute it.

    Here are the steps to the simplest way to execute Javascript (parsing and executing at runtime):

  • Parsing and Preprocessing (recursive descent or otherwise)
  • Analysis
  • Execution


    Chrome's Javascript Engine compiles Javascript to native platform-specific machine code (for optimum performance) It also has a Garbage Collection Mechanism.

提交回复
热议问题