Is there a decompiler or disassembler in bytecode in javascript? Here is an example from python.
In [6]: def f(): ...: a=1 ...: In [7]: dis.dis(f) 2 0 LOAD_CONST 1 (1) 3 STORE_FAST 0 (a) 6 LOAD_CONST 0 (None) 9 RETURN_VALUE Is there a decompiler or disassembler in bytecode in javascript? Here is an example from python.
In [6]: def f(): ...: a=1 ...: In [7]: dis.dis(f) 2 0 LOAD_CONST 1 (1) 3 STORE_FAST 0 (a) 6 LOAD_CONST 0 (None) 9 RETURN_VALUE For the V8 ( chromium / chrome js engine ), you can use the built-in disassembler:
First build the source engine, including support for the disassembler:
make ia32.release objectprint=on disassembler=on Then run d8 shell, with options
out/ia32.release/d8 --print-opt-code --code-comments --trace-hydrogen your_app.js The first two options will print the assembler code with comments. The third option will generate a trace that can be viewed using the C1Visualizer.
honestly took the solution from Quora , did not check v8 on the latest sources
Corresponding options for spidermonkey (FF engine):
IONFLAGS=codegen js --ion-offthread-compile=off app.js taken from enSO: Print ion monkey generated code
Source: https://ru.stackoverflow.com/questions/482059/
All Articles