I tried that first. Even when using Script::New, I have to create a context and enter it; otherwise, I get a segmentation fault at:
15 v8::internal::FixedArray::get() /space/projects/v8/src/objects-inl.h:2116 0x00007ffff5ca681a 14 v8::internal::Context::global_object() /space/projects/v8/src/contexts.h:372 0x00007ffff5ca413f 13 v8::internal::Isolate::global_context() /space/projects/v8/src/isolate.cc:1405 0x00007ffff5f081c6 12 v8::Script::New() /space/projects/v8/src/api.cc:1669 0x00007ffff5cc56a3 where FixedArray is null. So is the idea that I still create a context and enter a context scope, but by doing New my script is not bound to that context? While using Compile, I could still create a new context and run the compiled script in the new context. I just need to make sure that the new context is created exactly the same way as the old one. So what is the actual difference? Jane On Monday, March 10, 2014 3:55:24 PM UTC-7, Ben Noordhuis wrote: > > On Mon, Mar 10, 2014 at 11:30 PM, Jane Chen <[email protected]<javascript:>> > wrote: > > I realize that Script is actually compiled under a specific context. > Given > > that, is it a good practice to cache a Script object and re-run it in > > different context? > > Use Script::New() instead of Script::Compile(), the former is context > independent. In case of doubt, consult v8.h, it's documented in > there. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
