@@ -771,11 +771,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
771771 bool produce_cached_data = false ;
772772 Local<Context> parsing_context = context;
773773
774- bool needs_custom_host_defined_options = false ;
774+ Local<Symbol> id_symbol ;
775775 if (argc > 2 ) {
776776 // new ContextifyScript(code, filename, lineOffset, columnOffset,
777777 // cachedData, produceCachedData, parsingContext,
778- // needsCustomHostDefinedOptions )
778+ // hostDefinedOptionId )
779779 CHECK_EQ (argc, 8 );
780780 CHECK (args[2 ]->IsNumber ());
781781 line_offset = args[2 ].As <Int32>()->Value ();
@@ -795,9 +795,8 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
795795 CHECK_NOT_NULL (sandbox);
796796 parsing_context = sandbox->context ();
797797 }
798- if (args[7 ]->IsTrue ()) {
799- needs_custom_host_defined_options = true ;
800- }
798+ CHECK (args[7 ]->IsSymbol ());
799+ id_symbol = args[7 ].As <Symbol>();
801800 }
802801
803802 ContextifyScript* contextify_script =
@@ -821,12 +820,6 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
821820
822821 Local<PrimitiveArray> host_defined_options =
823822 PrimitiveArray::New (isolate, loader::HostDefinedOptions::kLength );
824- // We need a default host defined options that's the same for all scripts
825- // not needing custom module callbacks for so that the isolate compilation
826- // cache can be hit.
827- Local<Symbol> id_symbol = needs_custom_host_defined_options
828- ? Symbol::New (isolate, filename)
829- : env->default_host_defined_options ();
830823 host_defined_options->Set (
831824 isolate, loader::HostDefinedOptions::kID , id_symbol);
832825
@@ -1199,6 +1192,10 @@ void ContextifyContext::CompileFunction(
11991192 params_buf = args[8 ].As <Array>();
12001193 }
12011194
1195+ // Argument 9: host-defined option symbol
1196+ CHECK (args[9 ]->IsSymbol ());
1197+ Local<Symbol> id_symbol = args[9 ].As <Symbol>();
1198+
12021199 // Read cache from cached data buffer
12031200 ScriptCompiler::CachedData* cached_data = nullptr ;
12041201 if (!cached_data_buf.IsEmpty ()) {
@@ -1210,7 +1207,6 @@ void ContextifyContext::CompileFunction(
12101207 // Set host_defined_options
12111208 Local<PrimitiveArray> host_defined_options =
12121209 PrimitiveArray::New (isolate, loader::HostDefinedOptions::kLength );
1213- Local<Symbol> id_symbol = Symbol::New (isolate, filename);
12141210 host_defined_options->Set (
12151211 isolate, loader::HostDefinedOptions::kID , id_symbol);
12161212
0 commit comments