From 3b1e5d9cf73d85e35f185640cf2882b3b4e069d4 Mon Sep 17 00:00:00 2001 From: Mythri Alle Date: Mon, 18 Dec 2017 16:09:29 +0000 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/18453 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Yang Guo Reviewed-By: Ali Ijaz Sheikh Reviewed-By: Michael Dawson --- src/node_contextify.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 21e48e6338a609..ef785936b77a69 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -880,8 +880,6 @@ class ContextifyScript : public BaseObject { if (source.GetCachedData() != nullptr) compile_options = ScriptCompiler::kConsumeCodeCache; - else if (produce_cached_data) - compile_options = ScriptCompiler::kProduceCodeCache; Context::Scope scope(maybe_context.FromMaybe(env->context())); @@ -903,8 +901,9 @@ class ContextifyScript : public BaseObject { args.This()->Set( env->cached_data_rejected_string(), Boolean::New(env->isolate(), source.GetCachedData()->rejected)); - } else if (compile_options == ScriptCompiler::kProduceCodeCache) { - const ScriptCompiler::CachedData* cached_data = source.GetCachedData(); + } else if (produce_cached_data) { + const ScriptCompiler::CachedData* cached_data = + ScriptCompiler::CreateCodeCache(v8_script.ToLocalChecked(), code); bool cached_data_produced = cached_data != nullptr; if (cached_data_produced) { MaybeLocal buf = Buffer::Copy(