4 ms·
Given that they already have coroutine support... how hard could it really be? Honest question for people familiar with V8/complex JIT compilers .
by mixedCase 4y ago
Given that they already have coroutine support... how hard could it really be? Honest question for people familiar with V8/complex JIT compilers .
- fathyb 4y agoSaving the VM state is not hard at all, the feature already exists (v8 snapshot) and is used in Chrome and Node.js to initialize the JS standard library. The problem is native handles. The DOM is easy to restore, but how do you restore a WebSocket connection? An IndexedDB transaction? A `Blob`, a stream, or a WebAssembly module that JavaScript assumes to be initiated? There are solutions to each one of these, but there are still a lot of remaining pieces that are stateful and not easy to restore or gracefully close. It's possible, but it requires a lot of work.
- vlovich123 4y agoI could be mistaken but I don’t believe that v8 snapshots support saving the vm in an arbitrary state. The snapshot is created after the script is compiled and that’s about all you can use to restore (it’s for speeding up loading the JS only).