Skip to content

Expose ScriptCompiler::CachedDataVersionTag #11506

@zertosh

Description

@zertosh

I'm using V8's code cache as exposed by vm in https://github.com/zertosh/v8-compile-cache, but I'm hitting cache versioning issues. I'd like know with certainty that a particular cache generated by one machine is compatible with another. ScriptCompiler::CachedDataVersionTag can let you do that (

node/deps/v8/include/v8.h

Lines 1379 to 1397 in ca48071

/**
* Return a version tag for CachedData for the current V8 version & flags.
*
* This value is meant only for determining whether a previously generated
* CachedData instance is still valid; the tag has no other meaing.
*
* Background: The data carried by CachedData may depend on the exact
* V8 version number or currently compiler flags. This means when
* persisting CachedData, the embedder must take care to not pass in
* data from another V8 version, or the same version with different
* features enabled.
*
* The easiest way to do so is to clear the embedder's cache on any
* such change.
*
* Alternatively, this tag can be stored alongside the cached data and
* compared when it is being used.
*/
static uint32_t CachedDataVersionTag();
).

I'd like to submit a PR exposing that data somewhere. Maybe expose it as a function on the vm module, or a static function on the Script constructor. Any ideas? Preferences?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions