How can I see the machine code generated by v8?

前端 未结 5 1731
北海茫月
北海茫月 2020-11-30 01:05

Does anybody know how I can see the actual machine code that v8 generates from Javascript? I\'ve gotten as far as Script::Compile() in src/api.cc b

5条回答
  •  臣服心动
    2020-11-30 01:24

    Try with NodeJS or Chrome:

    1. -print-opt-code: Code generated by optimizing compiler.
    2. -print-bytecode: Byte code generated by interpreter.
    3. -trace-opt and -trace-depot : which functions are (de)optimized.

    Check this article by @Franziska Hinkelmann :

    https://medium.com/dailyjs/understanding-v8s-bytecode-317d46c94775

    Additionally you can also try

    D8: It will help you compile V8 and view the assembly code generated from JavaScript.

    For usage and details:

    http://www.mattzeunert.com/2015/08/19/viewing-assembly-code-generated-by-v8.html

提交回复
热议问题