@@ -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
@@ -1200,6 +1193,10 @@ void ContextifyContext::CompileFunction(
12001193 params_buf = args[8 ].As <Array>();
12011194 }
12021195
1196+ // Argument 10: host-defined option symbol
1197+ CHECK (args[9 ]->IsSymbol ());
1198+ Local<Symbol> id_symbol = args[9 ].As <Symbol>();
1199+
12031200 // Read cache from cached data buffer
12041201 ScriptCompiler::CachedData* cached_data = nullptr ;
12051202 if (!cached_data_buf.IsEmpty ()) {
@@ -1211,7 +1208,6 @@ void ContextifyContext::CompileFunction(
12111208 // Set host_defined_options
12121209 Local<PrimitiveArray> host_defined_options =
12131210 PrimitiveArray::New (isolate, loader::HostDefinedOptions::kLength );
1214- Local<Symbol> id_symbol = Symbol::New (isolate, filename);
12151211 host_defined_options->Set (
12161212 isolate, loader::HostDefinedOptions::kID , id_symbol);
12171213
0 commit comments