0

I have learnt about how V8 of chrome browser works in an abstract view from this webpage https://blog.bitsrc.io/how-does-javascript-really-work-part-1-7681dd54a36d

the interpreter(ignition) converts it into bytecode... but then who will convert this bytecode to machine code ?

5
  • An "interpreter" typically doesn't compile the bytecode into machine code - Jitting is the task of turbofan, which is however a different topic. Commented Oct 15, 2021 at 16:05
  • There's a lot of information available online describing code compilation. What other docs have you read so far, and is there a specific aspect that isn't explained very well? Commented Oct 15, 2021 at 16:08
  • I have only read this article because all other lead me to the java or some lead me to very difficult answers, which i am not able to understand. Commented Oct 15, 2021 at 16:15
  • i know this flow JS -> parser -> AST -> interpreter -> bytecode -> missing thing -> machine code i wanna know this missing thing. Commented Oct 15, 2021 at 16:17
  • Please read the wikipedia article about what an interpreter generally does, which i linked. There is typically a fork there, the code either gets interpreted, or (when hot) jit to machine code. That turbofan happens to use the bytecode is a coincidence. Commented Oct 15, 2021 at 16:20

1 Answer 1

1

It doesn't turn the bytecode into machine code.

the Ignition interpreter takes the Abstract syntax tree and produce a bytecode from it.

after the bytecode has been produced the Ignition interpreter it start to execute those bytecodes directly.

i know it's a bit confusing when you hear that the interpreter produce a bytecodes and also execute those bytecodes.

but that's actually what the Ignition interpreter does. it's not only executing it's also producing bytecodes so don't get confused by the name.

for example we have the following bytecode

LdaSmi 5

when the Ignition sees that bytecode it will actually call a function from the engine which handles that instruction.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.