On Tue, Mar 11, 2014 at 5:29 PM, Jane Chen <[email protected]> wrote: > 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
You're right that you always need to enter a context first before evaluating a script. The difference between Context::New() and Context::Compile() is the context where built-in objects like the Array and RegExp constructors are looked up in. They come from the global context with Context::New() and from the bound context with Context::Compile(). -- -- 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.
