7

Question:

I've heard people use the terms dynamic compilation and interpretation interchangeably. This isn't a question about semantics.

Obviously by the time the code hits the processor it is in some binary form.

How can I look at intermediate represenation?

For example, it is pretty easy to look at your C code in assembly by using compiler options.

Is there a similar way to do this with JavaScript? I'm not sure what the intermediary representation would be called but here are some general references.

Research

Clarification:

This question has nothing to do with minification.

Cairnarvon
28.2k9 gold badges55 silver badges66 bronze badges
asked Jan 5, 2013 at 22:03
9
  • 1
    If I may ask, why do you want to find a way to do this? Commented Jan 5, 2013 at 22:06
  • So, you mean optimization? Commented Jan 5, 2013 at 22:14
  • 4
    For V8, you can run d8 --print_code or d8 --print_opt_code Commented Jan 5, 2013 at 22:15
  • 9
    There is no one standard, universally agreed-upon internal representation for JavaScript and each JS engine interprets or compiles JS in its own way. You are probably best off picking a nice JS engine like Rhino and checking the docs to see if it can do what you want it to do. Commented Jan 11, 2013 at 17:30
  • 2
    @templatetypedef - that comment seems like an answer to me :) Commented Jan 11, 2013 at 17:44

2 Answers 2

1

If you build V8 yourself by compiling the d8 shell, you can run d8 --print_code or d8 --print_opt_code. You probably want to output this data into a file.

answered Mar 28, 2013 at 21:32
Sign up to request clarification or add additional context in comments.

Comments

1

See if these slides from Vyacheslav Egorov's mö.js JSConf talk get you any closer to what you need.

answered Jan 17, 2013 at 0:45

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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