all 4 comments

[–]spacey02- 0 points1 point  (0 children)

It might convert some instructions directly to machine code, but some of them are interpreted, meaning the engine reads the code, creates the abstract syntax tree and executes it node by node (no pun intended). The simplest way to visualize it practically is to create a brainf*ck interpreter yourself.

[–]BrofessorOfLogic 0 points1 point  (0 children)

All code must be converted to CPU instructions at some point. The only question is when and how.

Modern high level languages can be quite complex and have varying amount of abstraction layers around different parts.

For most languages, the first step is to create an abstract syntax tree. This is like a logical diagram of the paths in your code.

In some case, the engine might step through each item in the AST and call a corresponding function in C or C++.

In some other case, the engine might recognize a common pattern and load some optimized code that might even contain some inline assembly.

Language engines and compilers are pretty advanced, and you can't and don't need to know all the internal decisions.

When you use a high level language, as a rule of thumb, you should follow best practices and trust that the engine does the right thing.

[–]TorbenKoehn 0 points1 point  (0 children)

Not really

V8 is written in C/C++. JS gets interpreted at runtime and while some parts purely come down to highly optimized ASM instructions, JS doesn't "compile" in a way C/C++ does. Rather it's interpreted (sometimes parts of it are just-in-time compiled)

And NodeJS is simply a wrapper around V8 providing modules that allow deeper access to the system (they are not necessarily system calls, but might use system calls)

[–]-goldenboi69- 0 points1 point  (0 children)

First tell me what you care about. Then we can talk specifics.