Home > Back-end >  when using V8 JS engine's --always-sparkplug flag and --print-code together to print out what m
when using V8 JS engine's --always-sparkplug flag and --print-code together to print out what m

Time:11-22

I'm using when using V8 JS engine's --always-sparkplug flag and --print-code together to print out the machine code generated by Sparkplug, I was wondering if the machine code printed by --print-code is exactly the executed machine code by V8.

If it is, can I execute the machine code outside of V8, say I can translate the machine code to llvm ir and then executed it in a llvm ir interpreter.

CodePudding user response:

I was wondering if the machine code printed by --print-code is exactly the executed machine code by V8.

Yes, at least for a while: the --always-sparkplug flag doesn't prevent tiering up to optimized compilation later.

can I execute the machine code outside of V8, say I can translate the machine code to llvm ir and then executed it in a llvm ir interpreter.

No, that's not supported: the code heavily relies on being executed in a V8 environment. (Which you'll find out quickly if you try to run it elsewhere.)

V8 isn't, and doesn't try to be, a standalone compiler.

  • Related