@@ -787,11 +787,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
787787 bool produce_cached_data = false ;
788788 Local<Context> parsing_context = context;
789789
790- bool needs_custom_host_defined_options = false ;
790+ Local<Symbol> id_symbol ;
791791 if (argc > 2 ) {
792792 // new ContextifyScript(code, filename, lineOffset, columnOffset,
793793 // cachedData, produceCachedData, parsingContext,
794- // needsCustomHostDefinedOptions )
794+ // hostDefinedOptionId )
795795 CHECK_EQ (argc, 8 );
796796 CHECK (args[2 ]->IsNumber ());
797797 line_offset = args[2 ].As <Int32>()->Value ();
@@ -811,9 +811,8 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
811811 CHECK_NOT_NULL (sandbox);
812812 parsing_context = sandbox->context ();
813813 }
814- if (args[7 ]->IsTrue ()) {
815- needs_custom_host_defined_options = true ;
816- }
814+ CHECK (args[7 ]->IsSymbol ());
815+ id_symbol = args[7 ].As <Symbol>();
817816 }
818817
819818 ContextifyScript* contextify_script =
@@ -837,12 +836,6 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
837836
838837 Local<PrimitiveArray> host_defined_options =
839838 PrimitiveArray::New (isolate, loader::HostDefinedOptions::kLength );
840- // We need a default host defined options that's the same for all scripts
841- // not needing custom module callbacks for so that the isolate compilation
842- // cache can be hit.
843- Local<Symbol> id_symbol = needs_custom_host_defined_options
844- ? Symbol::New (isolate, filename)
845- : env->default_host_defined_options ();
846839 host_defined_options->Set (
847840 isolate, loader::HostDefinedOptions::kID , id_symbol);
848841
@@ -1201,6 +1194,10 @@ void ContextifyContext::CompileFunction(
12011194 params_buf = args[8 ].As <Array>();
12021195 }
12031196
1197+ // Argument 10: host-defined option symbol
1198+ CHECK (args[9 ]->IsSymbol ());
1199+ Local<Symbol> id_symbol = args[9 ].As <Symbol>();
1200+
12041201 // Read cache from cached data buffer
12051202 ScriptCompiler::CachedData* cached_data = nullptr ;
12061203 if (!cached_data_buf.IsEmpty ()) {
@@ -1212,7 +1209,6 @@ void ContextifyContext::CompileFunction(
12121209 // Set host_defined_options
12131210 Local<PrimitiveArray> host_defined_options =
12141211 PrimitiveArray::New (isolate, loader::HostDefinedOptions::kLength );
1215- Local<Symbol> id_symbol = Symbol::New (isolate, filename);
12161212 host_defined_options->Set (
12171213 isolate, loader::HostDefinedOptions::kID , id_symbol);
12181214
0 commit comments