Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Quick Overview To JavaScript Engines
Pato
Pato

Posted on • Edited on

     

Quick Overview To JavaScript Engines

You don't need to know how the JavaScript engines work in order to learn JavaScript but it's always good to learn how things work under the hood.

Keep in mind that every JavaScript gets interpreted differently depending on what engine your browser is using.

JavaScript parsing: This means that your browser reads your javascript code.

JavaScript execution: This is the actual process where our code does something.

When the code isparsed andexecuted that is when the browsers makes use of the JavaScript engine.

The engine for Google Chrome is called v8, and the one for Firebox its called SpiderMonkey.

For more info on:
GoogleV8
FireboxSpiderMonkey

Typically the engines have two parts:

-The Interpreter
-The Compiler (Usually a just-in-time compiler) aka JiT

Note: In this post, we will focus on how the engines generally work, not what the engines do when the code executes.

The Interpreter

This is where our engine parses/loads our script (JavaScript code), reads it, then translates it to byte code, and finally starts the execution. The byte code is giving to the compiler.

The Compiler

Compiles your script into machine code. So the translation from JavaScript code to machine code is what our compiler does.

Remember: that just-in-time compilation means that our compiler starts compiling and executing the compiled code.

JavaScript Engine Does Optimization

If you wrote a script and then modified part of it, the JavaScript engine checks what code didn't change between the last execution and the one that is currently running. The current version not always gets re-compiled. The engine checks what code has been compiled and doesn't compile it again, which makes the engine's process faster.

Browser APIs

Our browsers come with default functions or objects that work with our JavaScript code. When we make use of this functions or objects that are in our browser APIs, the engine interprets and compiles our code then the browser knows where are these functions or objects coming are from.

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
huylong profile image
huylong
I'm developer
  • Location
    Da Nang
  • Work
    frontend at google
  • Joined

Thank you

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Google Developer Expert | Auth0 Ambassador | Media Developer Expert at Cloudinary | Twilio Champ | Technical Coach at SpringBoard | Google Women Techmaker | Postman Supernova | AWS | Microsoft MVP
  • Location
    New York, US
  • Education
    B.S Computer Science
  • Work
    Staff Developer Advocate - PayPal
  • Joined

More fromPato

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp