Subj : Re: Compile the Javascript code to Bytecode. To : netscape.public.mozilla.jseng From : Alfred Date : Mon Oct 03 2005 04:29 am Hi Peter, It's great, I just wanted to dump the bytecode in human readable format using Spidermonkey. Since you have done some of the work, I think maybe I can do some help. Regards Alfred Peter Paulus wrote: > Hello Alfred, > > If you are Spidermonkey based, I've been doing some work on dumping the > bytecode in human readable form. This is far from complete though. I did > some investigation in this direction, but ceased work after only a few > days. If you are interested I can send you my code. > > What is stored internally after you have compiled a script is bytecode. > On the JSScript structure the 'code' field points into the bytecode. The > 'length' member field tells you what size the bytecode has. > > The 'main' member field tells you where executable code starts. > > What I haven't figured out in this respect is where the table with > constants, strings etc. is. I think this is behind the 'atomMap' member > field. > > Files 'jsopcode.h' and 'jsopcode.tbl' give you a lot of hints about > bytecode. > > If you are interested in dumping the bytecode octets in binary form, It > should not be to hard to build that. Dumping 'length' bytes of the > 'code' field get's you half way. You'd only have to figure out how to > dump the atomMap. > > Hope that helps, > > With kind regards, > Peter Paulus .