jackson
jackson

Reputation: 127

V8/Ignition: Print bytecode of just the top-level code of a JavaScript file

I know both D8 and Node.js have the options --print-bytecode to print the bytecode during execution and --print-bytecode-filter to limit which function I want printed. But is there any way to limit the printed bytecode only to the top-level code of a script instead of a specific function in it?

Upvotes: 0

Views: 1014

Answers (1)

jmrk
jmrk

Reputation: 40511

Let me help you help yourself:

(1) Use source.chromium.org to search for FLAG_print_bytecode_filter.

(2) Take a look at the code that handles the flag, in particular this snippet:

  if (shared->is_toplevel()) {
    base::Vector<const char> filter =
        base::CStrVector(FLAG_print_bytecode_filter);
    return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*');
  }

(3) That's your answer: --print-bytecode-filter="" limits bytecode printing to the top-level code.

Upvotes: 2

Related Questions