On Tue, Feb 28, 2012 at 4:29 AM, BrianG <[email protected]> wrote:

> Hi,
> I need my code to be fairly isolated so I'm creating and destroying
> contexts very frequently, is there anyway to save compiled script so
> that it can be used across contexts and so that it can easily just be
> run inside a new context? If not, is there a way to "image" a context
> and quickly reload it with the compiled script already ready to go?
>

This might be useful...

>From the Script class:

  /**
   * Compiles the specified script (context-independent).
   *
   * \param source Script source code.
   * \param origin Script origin, owned by caller, no references are kept
   *   when New() returns
   * \param pre_data Pre-parsing data, as obtained by
ScriptData::PreCompile()
   *   using pre_data speeds compilation if it's done multiple times.
   *   Owned by caller, no references are kept when New() returns.
   * \param script_data Arbitrary data associated with script. Using
   *   this has same effect as calling SetData(), but allows data to be
   *   available to compile event handlers.
   * \return Compiled script object (context independent; when run it
   *   will use the currently entered context).
   */
  static Local<Script> New(Handle<String> source,
                           ScriptOrigin* origin = NULL,
                           ScriptData* pre_data = NULL,
                           Handle<String> script_data = Handle<String>());



-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to