Consuming code cache from older V8 version

96 views
Skip to first unread message

Tekman

unread,
Jan 16, 2024, 8:40:19 PM1/16/24
to v8-dev
Hi,

We use a code cache to speed up load times for large JavaScript bundles. We reload the cache by passing kConsumeCodeCache and a CachedData into ScriptCompiler::Compile. 

This generally works fine except when moving between some versions of V8 (which I presume alters the layout of some of the serialized structures).

The problem is the failure presents as a crash (V8_Fatal called a few layers into a v8::internal::Deserializer). Is there a way to validate the cache or otherwise treat this as an exception we can handle instead? (if we fail to load the cache, we'd just load the bundle from source and preserve the new cache, no big deal, but the crash just brings down the whole program).

Thanks!

Ronald Fenner

unread,
Jan 19, 2024, 8:54:22 AM1/19/24
to v8-dev
Not sure there is but it's probably safer when your app updates with a different version of v8 to just flush the whole cache.

Keyhan Vakil

unread,
Jan 19, 2024, 5:57:15 PM1/19/24
to v8-...@googlegroups.com
You can key your cache on v8::ScriptCompiler::CachedDataVersionTag.

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/77197a60-0411-42bf-abfd-b615d5147501n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages