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.h"
9 #include "src/objects/hash-table.h"
10 
11 // Has to be the last include (doesn't have include guards):
12 #include "src/objects/object-macros.h"
13 
14 namespace v8 {
15 namespace internal {
16 
17 // TemplateObjectDescription is a triple of hash, raw strings and cooked
18 // strings for tagged template literals. Used to communicate with the runtime
19 // for template object creation within the {Runtime_CreateTemplateObject}
20 // method.
21 class TemplateObjectDescription final : public Tuple2 {
22  public:
23   DECL_ACCESSORS(raw_strings, FixedArray)
24   DECL_ACCESSORS(cooked_strings, FixedArray)
25 
26   static Handle<JSArray> CreateTemplateObject(
27       Isolate* isolate, Handle<TemplateObjectDescription> description);
28 
29   DECL_CAST(TemplateObjectDescription)
30 
31   static constexpr int kRawStringsOffset = kValue1Offset;
32   static constexpr int kCookedStringsOffset = kValue2Offset;
33 
34  private:
35   DISALLOW_IMPLICIT_CONSTRUCTORS(TemplateObjectDescription);
36 };
37 
38 }  // namespace internal
39 }  // namespace v8
40 
41 #include "src/objects/object-macros-undef.h"
42 
43 #endif  // V8_OBJECTS_TEMPLATE_OBJECTS_H_
44