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_PROPERTY_DESCRIPTOR_OBJECT_H_ 6 #define V8_OBJECTS_PROPERTY_DESCRIPTOR_OBJECT_H_ 7 8 #include "src/objects.h" 9 #include "src/objects/fixed-array.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 class PropertyDescriptorObject : public FixedArray { 18 public: 19 #define FLAGS_BIT_FIELDS(V, _) \ 20 V(IsEnumerableBit, bool, 1, _) \ 21 V(HasEnumerableBit, bool, 1, _) \ 22 V(IsConfigurableBit, bool, 1, _) \ 23 V(HasConfigurableBit, bool, 1, _) \ 24 V(IsWritableBit, bool, 1, _) \ 25 V(HasWritableBit, bool, 1, _) \ 26 V(HasValueBit, bool, 1, _) \ 27 V(HasGetBit, bool, 1, _) \ 28 V(HasSetBit, bool, 1, _) 29 30 DEFINE_BIT_FIELDS(FLAGS_BIT_FIELDS) 31 #undef FLAGS_BIT_FIELDS 32 33 enum { kFlagsIndex, kValueIndex, kGetIndex, kSetIndex, kLength }; 34 35 DECL_CAST(PropertyDescriptorObject) 36 37 static const int kRegularAccessorPropertyBits = 38 HasEnumerableBit::kMask | HasConfigurableBit::kMask | HasGetBit::kMask | 39 HasSetBit::kMask; 40 41 static const int kRegularDataPropertyBits = 42 HasEnumerableBit::kMask | HasConfigurableBit::kMask | 43 HasWritableBit::kMask | HasValueBit::kMask; 44 45 static const int kHasMask = HasEnumerableBit::kMask | 46 HasConfigurableBit::kMask | 47 HasWritableBit::kMask | HasValueBit::kMask | 48 HasGetBit::kMask | HasSetBit::kMask; 49 50 static const int kValueOffset = 51 FixedArray::OffsetOfElementAt(PropertyDescriptorObject::kValueIndex); 52 static const int kFlagsOffset = 53 FixedArray::OffsetOfElementAt(PropertyDescriptorObject::kFlagsIndex); 54 static const int kGetOffset = 55 FixedArray::OffsetOfElementAt(PropertyDescriptorObject::kGetIndex); 56 static const int kSetOffset = 57 FixedArray::OffsetOfElementAt(PropertyDescriptorObject::kSetIndex); 58 }; 59 60 } // namespace internal 61 } // namespace v8 62 63 #include "src/objects/object-macros-undef.h" 64 65 #endif // V8_OBJECTS_PROPERTY_DESCRIPTOR_OBJECT_H_ 66