Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sea: don't set code cache flags when snapshot is used #54120

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/node_sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,14 @@ std::optional<SeaConfig> ParseSingleExecutableConfig(
return std::nullopt;
}
if (use_code_cache.value()) {
result.flags |= SeaFlags::kUseCodeCache;
if (use_snapshot.value()) {
// TODO(joyeecheung): code cache in snapshot should be configured by
// separate snapshot configurations.
FPrintF(stderr,
"\"useCodeCache\" is redundant when \"useSnapshot\" is true\n");
} else {
result.flags |= SeaFlags::kUseCodeCache;
}
}

auto assets_opt = parser.GetTopLevelStringDict("assets");
Expand Down Expand Up @@ -511,19 +518,14 @@ ExitCode GenerateSingleExecutableBlob(
std::optional<std::string_view> optional_sv_code_cache;
std::string code_cache;
if (static_cast<bool>(config.flags & SeaFlags::kUseCodeCache)) {
if (builds_snapshot_from_main) {
FPrintF(stderr,
"\"useCodeCache\" is redundant when \"useSnapshot\" is true\n");
} else {
std::optional<std::string> optional_code_cache =
GenerateCodeCache(config.main_path, main_script);
if (!optional_code_cache.has_value()) {
FPrintF(stderr, "Cannot generate V8 code cache\n");
return ExitCode::kGenericUserError;
}
code_cache = optional_code_cache.value();
optional_sv_code_cache = code_cache;
std::optional<std::string> optional_code_cache =
GenerateCodeCache(config.main_path, main_script);
if (!optional_code_cache.has_value()) {
FPrintF(stderr, "Cannot generate V8 code cache\n");
return ExitCode::kGenericUserError;
}
code_cache = optional_code_cache.value();
optional_sv_code_cache = code_cache;
}

std::unordered_map<std::string, std::string> assets;
Expand Down
Loading