@@ -373,7 +373,14 @@ std::optional<SeaConfig> ParseSingleExecutableConfig( |
373 | 373 | return std::nullopt; |
374 | 374 | } |
375 | 375 | if (use_code_cache.value()) { |
376 | | - result.flags |= SeaFlags::kUseCodeCache; |
| 376 | + if (use_snapshot.value()) { |
| 377 | + // TODO(joyeecheung): code cache in snapshot should be configured by |
| 378 | + // separate snapshot configurations. |
| 379 | + FPrintF(stderr, |
| 380 | + "\"useCodeCache\" is redundant when \"useSnapshot\" is true\n"); |
| 381 | + } else { |
| 382 | + result.flags |= SeaFlags::kUseCodeCache; |
| 383 | + } |
377 | 384 | } |
378 | 385 |
|
379 | 386 | auto assets_opt = parser.GetTopLevelStringDict("assets"); |
@@ -529,19 +536,14 @@ ExitCode GenerateSingleExecutableBlob( |
529 | 536 | std::optional<std::string_view> optional_sv_code_cache; |
530 | 537 | std::string code_cache; |
531 | 538 | if (static_cast<bool>(config.flags & SeaFlags::kUseCodeCache)) { |
532 | | - if (builds_snapshot_from_main) { |
533 | | - FPrintF(stderr, |
534 | | - "\"useCodeCache\" is redundant when \"useSnapshot\" is true\n"); |
535 | | - } else { |
536 | | - std::optional<std::string> optional_code_cache = |
537 | | - GenerateCodeCache(config.main_path, main_script); |
538 | | - if (!optional_code_cache.has_value()) { |
539 | | - FPrintF(stderr, "Cannot generate V8 code cache\n"); |
540 | | - return ExitCode::kGenericUserError; |
541 | | - } |
542 | | - code_cache = optional_code_cache.value(); |
543 | | - optional_sv_code_cache = code_cache; |
| 539 | + std::optional<std::string> optional_code_cache = |
| 540 | + GenerateCodeCache(config.main_path, main_script); |
| 541 | + if (!optional_code_cache.has_value()) { |
| 542 | + FPrintF(stderr, "Cannot generate V8 code cache\n"); |
| 543 | + return ExitCode::kGenericUserError; |
544 | 544 | } |
| 545 | + code_cache = optional_code_cache.value(); |
| 546 | + optional_sv_code_cache = code_cache; |
545 | 547 | } |
546 | 548 |
|
547 | 549 | std::unordered_map<std::string, std::string> assets; |
|