Subj : Re: Persistent storage of compiled scripts To : netscape.public.mozilla.jseng From : Brendan Eich Date : Wed Jul 21 2004 11:47 am Thorsten R wrote: > Thank you for your help. I will take a close look at your hints. > > I was in doubt if a compiled script already contains pointers to internal > objects (and external objects as well as external C-functions). Do your > hints really mean that I can store a compiled script to file, completely > shutdown my application and run the application days later using those > compiled scripts? This would mean that compiled scripts are "linked" at > runtime to objects in the engine. Yes, that's right to some extent: "objects" linked at load time, or deserialize time, are the atoms representing literals in the script. The serialized format contains just enough information to reconstitute new atoms, or find matching existing ones (3.14 or "hello, world" or /re/) and reference them from the JSScript. > Or are objects never resolved to pointers in the p-code, i.e. does the > engine always a search by name to reference an object during the execution > of the p-code? That's right, too -- JS by definition looks up most names at run-time. Only unambiguous local variable and argument names are resolved to stack frame slots at compile-time. /be .