@@ -202,19 +202,12 @@ Handle<Dictionary> ShallowCopyDictionaryTemplate(
202202
203203template <typename Dictionary>
204204bool SubstituteValues (Isolate* isolate, Handle<Dictionary> dictionary,
205- RuntimeArguments& args,
206- bool * install_name_accessor = nullptr ) {
207- Handle<Name> name_string = isolate->factory ()->name_string ();
208-
205+ RuntimeArguments& args) {
209206 // Replace all indices with proper methods.
210207 ReadOnlyRoots roots (isolate);
211208 for (InternalIndex i : dictionary->IterateEntries ()) {
212209 Object maybe_key = dictionary->KeyAt (i);
213210 if (!Dictionary::IsKey (roots, maybe_key)) continue ;
214- if (install_name_accessor && *install_name_accessor &&
215- (maybe_key == *name_string)) {
216- *install_name_accessor = false ;
217- }
218211 Handle<Object> key (maybe_key, isolate);
219212 Handle<Object> value (dictionary->ValueAt (i), isolate);
220213 if (value->IsAccessorPair ()) {
@@ -400,7 +393,7 @@ bool AddDescriptorsByTemplate(
400393 Handle<Dictionary> properties_dictionary_template,
401394 Handle<NumberDictionary> elements_dictionary_template,
402395 Handle<FixedArray> computed_properties, Handle<JSObject> receiver,
403- bool install_name_accessor, RuntimeArguments& args) {
396+ RuntimeArguments& args) {
404397 int computed_properties_length = computed_properties->length ();
405398
406399 // Shallow-copy properties template.
@@ -438,20 +431,9 @@ bool AddDescriptorsByTemplate(
438431 }
439432
440433 // Replace all indices with proper methods.
441- if (!SubstituteValues<Dictionary>(isolate, properties_dictionary, args,
442- &install_name_accessor)) {
434+ if (!SubstituteValues<Dictionary>(isolate, properties_dictionary, args)) {
443435 return false ;
444436 }
445- if (install_name_accessor) {
446- PropertyAttributes attribs =
447- static_cast <PropertyAttributes>(DONT_ENUM | READ_ONLY);
448- PropertyDetails details (kAccessor , attribs,
449- PropertyDetails::kConstIfDictConstnessTracking );
450- Handle<Dictionary> dict = ToHandle (Dictionary::Add (
451- isolate, properties_dictionary, isolate->factory ()->name_string (),
452- isolate->factory ()->function_name_accessor (), details));
453- CHECK_EQ (*dict, *properties_dictionary);
454- }
455437
456438 UpdateProtectors (isolate, receiver, properties_dictionary);
457439
@@ -520,23 +502,18 @@ bool InitClassPrototype(Isolate* isolate,
520502 map->set_may_have_interesting_symbols (true );
521503 map->set_construction_counter (Map::kNoSlackTracking );
522504
523- // Class prototypes do not have a name accessor.
524- const bool install_name_accessor = false ;
525-
526505 if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
527506 Handle<SwissNameDictionary> properties_dictionary_template =
528507 Handle<SwissNameDictionary>::cast (properties_template);
529508 return AddDescriptorsByTemplate (
530509 isolate, map, properties_dictionary_template,
531- elements_dictionary_template, computed_properties, prototype,
532- install_name_accessor, args);
510+ elements_dictionary_template, computed_properties, prototype, args);
533511 } else {
534512 Handle<NameDictionary> properties_dictionary_template =
535513 Handle<NameDictionary>::cast (properties_template);
536514 return AddDescriptorsByTemplate (
537515 isolate, map, properties_dictionary_template,
538- elements_dictionary_template, computed_properties, prototype,
539- install_name_accessor, args);
516+ elements_dictionary_template, computed_properties, prototype, args);
540517 }
541518 }
542519}
@@ -582,24 +559,19 @@ bool InitClassConstructor(Isolate* isolate,
582559 map->set_may_have_interesting_symbols (true );
583560 map->set_construction_counter (Map::kNoSlackTracking );
584561
585- // All class constructors have a name accessor.
586- const bool install_name_accessor = true ;
587-
588562 if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
589563 Handle<SwissNameDictionary> properties_dictionary_template =
590564 Handle<SwissNameDictionary>::cast (properties_template);
591565
592566 return AddDescriptorsByTemplate (
593567 isolate, map, properties_dictionary_template,
594- elements_dictionary_template, computed_properties, constructor,
595- install_name_accessor, args);
568+ elements_dictionary_template, computed_properties, constructor, args);
596569 } else {
597570 Handle<NameDictionary> properties_dictionary_template =
598571 Handle<NameDictionary>::cast (properties_template);
599572 return AddDescriptorsByTemplate (
600573 isolate, map, properties_dictionary_template,
601- elements_dictionary_template, computed_properties, constructor,
602- install_name_accessor, args);
574+ elements_dictionary_template, computed_properties, constructor, args);
603575 }
604576 }
605577}
0 commit comments