• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_LITERAL_OBJECTS_H_
6 #define V8_OBJECTS_LITERAL_OBJECTS_H_
7 
8 #include "src/objects.h"
9 
10 // Has to be the last include (doesn't have include guards):
11 #include "src/objects/object-macros.h"
12 
13 namespace v8 {
14 namespace internal {
15 
16 // BoilerplateDescription is a list of properties consisting of name value
17 // pairs. In addition to the properties, it provides the projected number
18 // of properties in the backing store. This number includes properties with
19 // computed names that are not
20 // in the list.
21 class BoilerplateDescription : public FixedArray {
22  public:
23   Object* name(int index) const;
24   Object* value(int index) const;
25 
26   // The number of boilerplate properties.
27   int size() const;
28 
29   // Number of boilerplate properties and properties with computed names.
30   int backing_store_size() const;
31 
32   void set_backing_store_size(Isolate* isolate, int backing_store_size);
33 
34   DECLARE_CAST(BoilerplateDescription)
35 
36  private:
37   bool has_number_of_properties() const;
38 };
39 
40 // Pair of {ElementsKind} and an array of constant values for {ArrayLiteral}
41 // expressions. Used to communicate with the runtime for literal boilerplate
42 // creation within the {Runtime_CreateArrayLiteral} method.
43 class ConstantElementsPair : public Struct {
44  public:
45   DECL_INT_ACCESSORS(elements_kind)
46   DECL_ACCESSORS(constant_values, FixedArrayBase)
47 
48   DECLARE_CAST(ConstantElementsPair)
49 
50   // Dispatched behavior.
51   DECLARE_PRINTER(ConstantElementsPair)
52   DECLARE_VERIFIER(ConstantElementsPair)
53 
54   static const int kElementsKindOffset = HeapObject::kHeaderSize;
55   static const int kConstantValuesOffset = kElementsKindOffset + kPointerSize;
56   static const int kSize = kConstantValuesOffset + kPointerSize;
57 
58  private:
59   DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantElementsPair);
60 };
61 
62 }  // namespace internal
63 }  // namespace v8
64 
65 #include "src/objects/object-macros-undef.h"
66 
67 #endif  // V8_OBJECTS_LITERAL_OBJECTS_H_
68