1// Copyright 2017 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef V8_OBJECTS_TEMPLATE_OBJECTS_H_ 6#define V8_OBJECTS_TEMPLATE_OBJECTS_H_ 7 8#include "src/objects/fixed-array.h" 9#include "src/objects/struct.h" 10#include "src/objects/torque-defined-classes.h" 11 12// Has to be the last include (doesn't have include guards): 13#include "src/objects/object-macros.h" 14 15namespace v8 { 16namespace internal { 17 18class StructBodyDescriptor; 19 20#include "torque-generated/src/objects/template-objects-tq.inc" 21 22// CachedTemplateObject is a tuple used to cache a TemplateObject that has been 23// created. All the CachedTemplateObject's for a given SharedFunctionInfo form a 24// linked list via the next fields. 25class CachedTemplateObject final 26 : public TorqueGeneratedCachedTemplateObject<CachedTemplateObject, Struct> { 27 public: 28 static Handle<CachedTemplateObject> New(Isolate* isolate, int slot_id, 29 Handle<JSArray> template_object, 30 Handle<HeapObject> next); 31 32 using BodyDescriptor = StructBodyDescriptor; 33 34 TQ_OBJECT_CONSTRUCTORS(CachedTemplateObject) 35}; 36 37// TemplateObjectDescription is a tuple of raw strings and cooked strings for 38// tagged template literals. Used to communicate with the runtime for template 39// object creation within the {Runtime_GetTemplateObject} method. 40class TemplateObjectDescription final 41 : public TorqueGeneratedTemplateObjectDescription<TemplateObjectDescription, 42 Struct> { 43 public: 44 static Handle<JSArray> GetTemplateObject( 45 Isolate* isolate, Handle<NativeContext> native_context, 46 Handle<TemplateObjectDescription> description, 47 Handle<SharedFunctionInfo> shared_info, int slot_id); 48 49 using BodyDescriptor = StructBodyDescriptor; 50 51 TQ_OBJECT_CONSTRUCTORS(TemplateObjectDescription) 52}; 53 54} // namespace internal 55} // namespace v8 56 57#include "src/objects/object-macros-undef.h" 58 59#endif // V8_OBJECTS_TEMPLATE_OBJECTS_H_ 60