Skip to content

Commit 685fca7

Browse files
mythriallehashseed
authored andcommitted
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
1 parent 1610ecf commit 685fca7

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
@@ -683,8 +683,6 @@ class ContextifyScript : public BaseObject {
683683

684684
if (source.GetCachedData() != nullptr)
685685
compile_options = ScriptCompiler::kConsumeCodeCache;
686-
else if (produce_cached_data)
687-
compile_options = ScriptCompiler::kProduceCodeCache;
688686

689687
Context::Scope scope(maybe_context.FromMaybe(env->context()));
690688

@@ -706,8 +704,9 @@ class ContextifyScript : public BaseObject {
706704
args.This()->Set(
707705
env->cached_data_rejected_string(),
708706
Boolean::New(env->isolate(), source.GetCachedData()->rejected));
709-
} else if (compile_options == ScriptCompiler::kProduceCodeCache) {
710-
const ScriptCompiler::CachedData* cached_data = source.GetCachedData();
707+
} else if (produce_cached_data) {
708+
const ScriptCompiler::CachedData* cached_data =
709+
ScriptCompiler::CreateCodeCache(v8_script.ToLocalChecked(), code);
711710
bool cached_data_produced = cached_data != nullptr;
712711
if (cached_data_produced) {
713712
MaybeLocal<Object> buf = Buffer::Copy(

0 commit comments

Comments
 (0)