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_INL_H_
6 #define V8_OBJECTS_LITERAL_OBJECTS_INL_H_
7
8 #include "src/objects-inl.h"
9 #include "src/objects/literal-objects.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 SMI_ACCESSORS(ObjectBoilerplateDescription, flags,
18 FixedArray::OffsetOfElementAt(kLiteralTypeOffset));
19
20 CAST_ACCESSOR(ClassBoilerplate)
21
22 BIT_FIELD_ACCESSORS(ClassBoilerplate, flags, install_class_name_accessor,
23 ClassBoilerplate::Flags::InstallClassNameAccessorBit)
24
25 BIT_FIELD_ACCESSORS(ClassBoilerplate, flags, arguments_count,
26 ClassBoilerplate::Flags::ArgumentsCountBits)
27
28 SMI_ACCESSORS(ClassBoilerplate, flags,
29 FixedArray::OffsetOfElementAt(kFlagsIndex));
30
31 ACCESSORS(ClassBoilerplate, static_properties_template, Object,
32 FixedArray::OffsetOfElementAt(kClassPropertiesTemplateIndex));
33
34 ACCESSORS(ClassBoilerplate, static_elements_template, Object,
35 FixedArray::OffsetOfElementAt(kClassElementsTemplateIndex));
36
37 ACCESSORS(ClassBoilerplate, static_computed_properties, FixedArray,
38 FixedArray::OffsetOfElementAt(kClassComputedPropertiesIndex));
39
40 ACCESSORS(ClassBoilerplate, instance_properties_template, Object,
41 FixedArray::OffsetOfElementAt(kPrototypePropertiesTemplateIndex));
42
43 ACCESSORS(ClassBoilerplate, instance_elements_template, Object,
44 FixedArray::OffsetOfElementAt(kPrototypeElementsTemplateIndex));
45
46 ACCESSORS(ClassBoilerplate, instance_computed_properties, FixedArray,
47 FixedArray::OffsetOfElementAt(kPrototypeComputedPropertiesIndex));
48
49 SMI_ACCESSORS(ArrayBoilerplateDescription, flags, kFlagsOffset);
50
51 ACCESSORS(ArrayBoilerplateDescription, constant_elements, FixedArrayBase,
52 kConstantElementsOffset);
53
elements_kind()54 ElementsKind ArrayBoilerplateDescription::elements_kind() const {
55 return static_cast<ElementsKind>(flags());
56 }
57
set_elements_kind(ElementsKind kind)58 void ArrayBoilerplateDescription::set_elements_kind(ElementsKind kind) {
59 set_flags(kind);
60 }
61
is_empty()62 bool ArrayBoilerplateDescription::is_empty() const {
63 return constant_elements()->length() == 0;
64 }
65
66 } // namespace internal
67 } // namespace v8
68
69 #include "src/objects/object-macros-undef.h"
70
71 #endif // V8_OBJECTS_LITERAL_OBJECTS_INL_H_
72