Skip to content

Commit

Permalink
src: request code cache explicitly
Browse files Browse the repository at this point in the history
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 <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>
  • Loading branch information
mythrialle authored and targos committed Mar 7, 2018
1 parent d727cf9 commit 3b1e5d9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand All @@ -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(
Expand Down

0 comments on commit 3b1e5d9

Please sign in to comment.