So it turns out that I was using *mksnapshot* incorrectly.

My procedure is now:-

1.  Create snapshot ...

       *./mksnapshot --extra_code my code.js my_snapshot.cc*

2.  Copy snapshot ...

*     cp **my_snapshot.cc*
* ./obj.target/v8_snapshot/geni/snapshot.cc*
     
3.  Rebuild *Node*

Starting *node* results in availability of code from *my_code.js*.

Thus far - the code that I can *snapshot* needs to be really simple, and not
dependent on other packages.

For instance - I cannot access  *console.log(..) * or use *require*.

 ... Any thoughts on getting these to work ?   Can I combine *many* JS 
files in a snapshot ?

Thanks in advance.

- Hugh


On Thursday, 7 January 2016 05:37:29 UTC-5, Jochen Eisinger wrote:
>
> The snapshot used by V8 in this case is only for builtin objects such as 
> Math or Date. The current version of V8 has something called "V8 extras" 
> that can be used to add additional scripts to the snapshot, but I'm not 
> aware of anybody using that for node.
>
> On Wed, Jan 6, 2016 at 9:22 PM Hugh Fitzpatrick <hugh.fit...@gmail.com 
> <javascript:>> wrote:
>
>>
>> Folks,
>>
>> I'm trying to understand how to use the 'snapshot' feature in v8.
>>
>> I am currently using node-v0.12.7 ... a little old - but should be ok.
>>
>> I have modified 'node.gyp' to enable snapshots.
>>
>> I can convert my sample 'foo.js' to 'snapshot.cc' via *mksnapshot* and 
>> see that v8::NewContextFromSnapshot() is being called. 
>>
>> So it seems that my snapshot is compiled-in, and being deserialized when 
>> I run .node'.
>>
>> 'foo.js'  contained a function called "sayHello()".
>>
>> I cannot call this function by v8-script-compile-run means or using the 
>> REPL from node.
>>
>> Question - What am I doing wrong ? 
>>
>> Is there a simple step-by-step example anywhere ?
>>
>> Thanks in advance.
>>
>> - Hugh
>>
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com <javascript:>
>> 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 v8-users+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to