Skip to content

Commit 3b1e5d9

Browse files
mythrialletargos
authored andcommitted
src: request code cache explicitly
Earlier we used to produce code cache along with compile. Now V8 has added an API to request code cache. Support for producing code cache along with compile will be removed soon. PR-URL: #18453 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yang Guo <[email protected]> Reviewed-By: Ali Ijaz Sheikh <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent d727cf9 commit 3b1e5d9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/node_contextify.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,6 @@ class ContextifyScript : public BaseObject {
880880

881881
if (source.GetCachedData() != nullptr)
882882
compile_options = ScriptCompiler::kConsumeCodeCache;
883-
else if (produce_cached_data)
884-
compile_options = ScriptCompiler::kProduceCodeCache;
885883

886884
Context::Scope scope(maybe_context.FromMaybe(env->context()));
887885

@@ -903,8 +901,9 @@ class ContextifyScript : public BaseObject {
903901
args.This()->Set(
904902
env->cached_data_rejected_string(),
905903
Boolean::New(env->isolate(), source.GetCachedData()->rejected));
906-
} else if (compile_options == ScriptCompiler::kProduceCodeCache) {
907-
const ScriptCompiler::CachedData* cached_data = source.GetCachedData();
904+
} else if (produce_cached_data) {
905+
const ScriptCompiler::CachedData* cached_data =
906+
ScriptCompiler::CreateCodeCache(v8_script.ToLocalChecked(), code);
908907
bool cached_data_produced = cached_data != nullptr;
909908
if (cached_data_produced) {
910909
MaybeLocal<Object> buf = Buffer::Copy(

0 commit comments

Comments
 (0)