summaryrefslogtreecommitdiff
path: root/src/node_contextify.cc
diff options
context:
space:
mode:
authorMythri Alle <mythria@chromium.org>2017-12-18 16:09:29 +0000
committerMichaƫl Zasso <targos@protonmail.com>2018-03-07 16:48:52 +0100
commit3b1e5d9cf73d85e35f185640cf2882b3b4e069d4 (patch)
treeb8c22630d2d47e43ba77d2f30824805e43e4fc32 /src/node_contextify.cc
parentd727cf923d90fdfdc5db3e221e69781817a7bba2 (diff)
downloadandroid-node-v8-3b1e5d9cf73d85e35f185640cf2882b3b4e069d4.tar.gz
android-node-v8-3b1e5d9cf73d85e35f185640cf2882b3b4e069d4.tar.bz2
android-node-v8-3b1e5d9cf73d85e35f185640cf2882b3b4e069d4.zip
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 <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r--src/node_contextify.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 21e48e6338..ef785936b7 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<Object> buf = Buffer::Copy(