@@ -355,7 +355,14 @@ std::optional<SeaConfig> ParseSingleExecutableConfig( |
355 | 355 | return std::nullopt; |
356 | 356 | } |
357 | 357 | if (use_code_cache.value()) { |
358 | | - result.flags |= SeaFlags::kUseCodeCache; |
| 358 | + if (use_snapshot.value()) { |
| 359 | + // TODO(joyeecheung): code cache in snapshot should be configured by |
| 360 | + // separate snapshot configurations. |
| 361 | + FPrintF(stderr, |
| 362 | + "\"useCodeCache\" is redundant when \"useSnapshot\" is true\n"); |
| 363 | + } else { |
| 364 | + result.flags |= SeaFlags::kUseCodeCache; |
| 365 | + } |
359 | 366 | } |
360 | 367 |
|
361 | 368 | auto assets_opt = parser.GetTopLevelStringDict("assets"); |
@@ -511,19 +518,14 @@ ExitCode GenerateSingleExecutableBlob( |
511 | 518 | std::optional<std::string_view> optional_sv_code_cache; |
512 | 519 | std::string code_cache; |
513 | 520 | if (static_cast<bool>(config.flags & SeaFlags::kUseCodeCache)) { |
514 | | - if (builds_snapshot_from_main) { |
515 | | - FPrintF(stderr, |
516 | | - "\"useCodeCache\" is redundant when \"useSnapshot\" is true\n"); |
517 | | - } else { |
518 | | - std::optional<std::string> optional_code_cache = |
519 | | - GenerateCodeCache(config.main_path, main_script); |
520 | | - if (!optional_code_cache.has_value()) { |
521 | | - FPrintF(stderr, "Cannot generate V8 code cache\n"); |
522 | | - return ExitCode::kGenericUserError; |
523 | | - } |
524 | | - code_cache = optional_code_cache.value(); |
525 | | - optional_sv_code_cache = code_cache; |
| 521 | + std::optional<std::string> optional_code_cache = |
| 522 | + GenerateCodeCache(config.main_path, main_script); |
| 523 | + if (!optional_code_cache.has_value()) { |
| 524 | + FPrintF(stderr, "Cannot generate V8 code cache\n"); |
| 525 | + return ExitCode::kGenericUserError; |
526 | 526 | } |
| 527 | + code_cache = optional_code_cache.value(); |
| 528 | + optional_sv_code_cache = code_cache; |
527 | 529 | } |
528 | 530 |
|
529 | 531 | std::unordered_map<std::string, std::string> assets; |
|