0

Before the Sparkplug compiler, JS code was first converted into byte code and executed, all done by the Ignition Interpreter. The Sparkplug compiler nowadays will take the byte code generated by Ignition Interpreter and turn it into machine code. Great. What executes code, though?

Does the Ignition Interpreter still execute it or maybe the CPU executes it now (machine code generated by Sparkplug)?

EDIT: There is also another JIT compiler called Maglev. So it adds even more confusion now

1
  • 2
    The question, "What executes code?", is confusing; what exactly do you mean? Of course in all cases some real CPU is running everything. Commented Dec 26, 2024 at 13:59

1 Answer 1

2

Ignition still executes bytecode as the first execution tier.

Machine code is executed by the CPU directly; that's what the term "machine code" means. V8 currently has three JavaScript compilers that generate machine code, in an increasingly optimized fashion for increasingly hot functions: Sparkplug, Maglev, and Turbofan.

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

2 Comments

Thank you very much for your answer, to be honest I was waiting for an actual V8 developer to come here, I really appreciate it! So, just to confirm. When the code is "slightly hot" it will be taken by a Sparkplug and turned into machine code. When it's "pretty hot" it will be taken by Maglev. When it's "hell-like hot" it will be taken by Turbofan. Correct?
@Sebastian Yes, that's the idea.

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.