Index: src/property-details.h |
diff --git a/src/property-details.h b/src/property-details.h |
index 4a3152d94d2e17e920f807614ae1ac054f047eba..dd29b1fa97580b731f91e4b1e07a15a3261cb7f2 100644 |
--- a/src/property-details.h |
+++ b/src/property-details.h |
@@ -41,10 +41,24 @@ typedef TypeImpl<ZoneTypeConfig> Type; |
class TypeInfo; |
// Type of properties. |
+// Order of kinds is significant. |
+// Must fit in the BitField PropertyDetails::KindField. |
+enum PropertyKind { DATA = 0, ACCESSOR = 1 }; |
+ |
+ |
+// Order of modes is significant. |
+// Must fit in the BitField PropertyDetails::StoreModeField. |
+enum PropertyStoreMode { IN_OBJECT = 0, IN_DESCRIPTOR = 1 }; |
Jakob Kummerow
2014/12/12 12:19:04
nit: we already have two enums called StoreMode. C
Igor Sheludko
2014/12/12 12:38:30
Renamed to PropertyLocation.
|
+ |
+ |
// Order of properties is significant. |
// Must fit in the BitField PropertyDetails::TypeField. |
// A copy of this is in mirror-debugger.js. |
-enum PropertyType { FIELD = 0, CONSTANT = 1, CALLBACKS = 2 }; |
+enum PropertyType { |
+ FIELD = (IN_OBJECT << 1) | DATA, |
+ CONSTANT = (IN_DESCRIPTOR << 1) | DATA, |
+ CALLBACKS = (IN_DESCRIPTOR << 1) | ACCESSOR |
+}; |
class Representation { |
@@ -222,6 +236,11 @@ class PropertyDetails BASE_EMBEDDED { |
return Representation::FromKind(static_cast<Representation::Kind>(bits)); |
} |
+ PropertyKind kind() const { return KindField::decode(value_); } |
+ PropertyStoreMode store_mode() const { |
+ return StoreModeField::decode(value_); |
+ } |
+ |
PropertyType type() const { return TypeField::decode(value_); } |
PropertyAttributes attributes() const { |
@@ -253,7 +272,8 @@ class PropertyDetails BASE_EMBEDDED { |
// Bit fields in value_ (type, shift, size). Must be public so the |
// constants can be embedded in generated code. |
- class TypeField : public BitField<PropertyType, 0, 2> {}; |
+ class KindField : public BitField<PropertyKind, 0, 1> {}; |
+ class StoreModeField : public BitField<PropertyStoreMode, 1, 1> {}; |
class AttributesField : public BitField<PropertyAttributes, 2, 3> {}; |
// Bit fields for normalized objects. |
@@ -268,6 +288,12 @@ class PropertyDetails BASE_EMBEDDED { |
: public BitField<uint32_t, 9 + kDescriptorIndexBitCount, |
kDescriptorIndexBitCount> {}; // NOLINT |
+ // NOTE: TypeField overlaps with KindField and StoreModeField. |
+ class TypeField : public BitField<PropertyType, 0, 2> {}; |
+ STATIC_ASSERT(KindField::kNext == StoreModeField::kShift); |
+ STATIC_ASSERT(TypeField::kShift == KindField::kShift); |
+ STATIC_ASSERT(TypeField::kNext == StoreModeField::kNext); |
+ |
// All bits for both fast and slow objects must fit in a smi. |
STATIC_ASSERT(DictionaryStorageField::kNext <= 31); |
STATIC_ASSERT(FieldIndexField::kNext <= 31); |