11cb0ef41Sopenharmony_ci// Copyright 2017 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_OBJECTS_TEMPLATE_OBJECTS_H_
61cb0ef41Sopenharmony_ci#define V8_OBJECTS_TEMPLATE_OBJECTS_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/objects/fixed-array.h"
91cb0ef41Sopenharmony_ci#include "src/objects/struct.h"
101cb0ef41Sopenharmony_ci#include "src/objects/torque-defined-classes.h"
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci// Has to be the last include (doesn't have include guards):
131cb0ef41Sopenharmony_ci#include "src/objects/object-macros.h"
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_cinamespace v8 {
161cb0ef41Sopenharmony_cinamespace internal {
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciclass StructBodyDescriptor;
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci#include "torque-generated/src/objects/template-objects-tq.inc"
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci// CachedTemplateObject is a tuple used to cache a TemplateObject that has been
231cb0ef41Sopenharmony_ci// created. All the CachedTemplateObject's for a given SharedFunctionInfo form a
241cb0ef41Sopenharmony_ci// linked list via the next fields.
251cb0ef41Sopenharmony_ciclass CachedTemplateObject final
261cb0ef41Sopenharmony_ci    : public TorqueGeneratedCachedTemplateObject<CachedTemplateObject, Struct> {
271cb0ef41Sopenharmony_ci public:
281cb0ef41Sopenharmony_ci  static Handle<CachedTemplateObject> New(Isolate* isolate, int slot_id,
291cb0ef41Sopenharmony_ci                                          Handle<JSArray> template_object,
301cb0ef41Sopenharmony_ci                                          Handle<HeapObject> next);
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci  using BodyDescriptor = StructBodyDescriptor;
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci  TQ_OBJECT_CONSTRUCTORS(CachedTemplateObject)
351cb0ef41Sopenharmony_ci};
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci// TemplateObjectDescription is a tuple of raw strings and cooked strings for
381cb0ef41Sopenharmony_ci// tagged template literals. Used to communicate with the runtime for template
391cb0ef41Sopenharmony_ci// object creation within the {Runtime_GetTemplateObject} method.
401cb0ef41Sopenharmony_ciclass TemplateObjectDescription final
411cb0ef41Sopenharmony_ci    : public TorqueGeneratedTemplateObjectDescription<TemplateObjectDescription,
421cb0ef41Sopenharmony_ci                                                      Struct> {
431cb0ef41Sopenharmony_ci public:
441cb0ef41Sopenharmony_ci  static Handle<JSArray> GetTemplateObject(
451cb0ef41Sopenharmony_ci      Isolate* isolate, Handle<NativeContext> native_context,
461cb0ef41Sopenharmony_ci      Handle<TemplateObjectDescription> description,
471cb0ef41Sopenharmony_ci      Handle<SharedFunctionInfo> shared_info, int slot_id);
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ci  using BodyDescriptor = StructBodyDescriptor;
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_ci  TQ_OBJECT_CONSTRUCTORS(TemplateObjectDescription)
521cb0ef41Sopenharmony_ci};
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci}  // namespace internal
551cb0ef41Sopenharmony_ci}  // namespace v8
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ci#include "src/objects/object-macros-undef.h"
581cb0ef41Sopenharmony_ci
591cb0ef41Sopenharmony_ci#endif  // V8_OBJECTS_TEMPLATE_OBJECTS_H_
60