52 int function_literal_id = shared_info->function_literal_id();
58 EphemeronHashTable::TodoShape::Hash(
ReadOnlyRoots(isolate), script);
70 template_weakmap->Lookup(isolate, script, hash);
71 if (!IsTheHole(cached_templates_lookup, roots)) {
74 maybe_cached_templates =
direct_handle(cached_templates, isolate);
79 for (
int i = 0;
i < cached_templates->length();
i++) {
82 if (CachedTemplateMatches(isolate, *
native_context, template_object,
83 function_literal_id, slot_id, no_gc)) {
95 isolate->factory()->NewJSArrayForTemplateLiteralArray(
96 cooked_strings, raw_strings, function_literal_id, slot_id);
100 if (!maybe_cached_templates.
ToHandle(&cached_templates)) {
101 cached_templates = isolate->factory()->NewArrayList(1);
103 cached_templates =
ArrayList::Add(isolate, cached_templates, template_object);
108 if (!maybe_cached_templates.
ToHandle(&old_cached_templates) ||
109 *old_cached_templates != *cached_templates) {
113 if (IsUndefined(maybe_template_weakmap)) {
114 template_weakmap = EphemeronHashTable::New(isolate, 1);
119 template_weakmap = EphemeronHashTable::Put(isolate, template_weakmap,
120 script, cached_templates, hash);
127 ->Lookup(isolate, script, hash),
129 DCHECK_EQ(cached_templates->get(cached_templates->length() - 1),
132 return template_object;
static V8_EXPORT_PRIVATE DirectHandle< ArrayList > Add(Isolate *isolate, DirectHandle< ArrayList > array, Tagged< Smi > obj, AllocationType allocation=AllocationType::kYoung)