Wasm support in snapshots was never added (see issue 8176 <http://crbug.com/v8/8176>). Supporting it would be a non-trivial amount of work, as we have to make sure to serialize the compiled Wasm code (living outside the JS heap) on snapshot creation, and properly reconstruct all involved functions and objects from that when deserializing.
Please go ahead and open an issue on http://crbug.com/v8/new and describe your use case, so we can include this in our planning for the upcoming quarters. Cheers, Clemens On Wed, Oct 26, 2022 at 8:07 AM 'Yulan Wang' via v8-users < v8-users@googlegroups.com> wrote: > I'm trying to use snapshot to cache the context with compiled code (JS > source code and wasm bytes code) inside. I can go througth with JS code. > > But for wasm, I can compile the wasm code in regular isolate, but once I > declare SnapshotCreator in the code like follow line: > > `Isolate::CreateParams create_params; > create_params.array_buffer_allocator = > v8::ArrayBuffer::Allocator::NewDefaultAllocator(); > auto isolate = Isolate::New(create_params); > SnapshotCreator creator(isolate);` > > WasmModuleObject::Compile doesn't work and return a non-WasmModuleObject. > > I also tried with v8::Script::Compile, and I got the same issue. The code > works without SnapshotCreator declare, but doesn't work with > SnapshotCreator. > > Is there any compiler restraint in SnapshotCreator that cannot compile > wasm code, or I miss any configs? Thanks! > > -- > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/v8-users/267acde6-1eb1-447b-b2f4-d0c8d2407992n%40googlegroups.com > <https://groups.google.com/d/msgid/v8-users/267acde6-1eb1-447b-b2f4-d0c8d2407992n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Clemens Backes Software Engineer cleme...@google.com Google Germany GmbH Erika-Mann-Straße 33 80636 München Geschäftsführer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person. -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/CAGO%3DqhC18E8uigrSkY3uxOO1mVRpE9f_6UqGZVJ8RfGjQ%3D4tEg%40mail.gmail.com.