Index: src/property-details.h |
diff --git a/src/property-details.h b/src/property-details.h |
index 2aa6dcfa959421d8c6e285d3b731fccb6dbc4b31..3ac33b3d4690e6bcd2d9f08159c51740440fab1e 100644 |
--- a/src/property-details.h |
+++ b/src/property-details.h |
@@ -76,6 +76,23 @@ enum PropertyType { |
}; |
+enum StorageType { |
+ TAGGED = 0, |
+ SMI = 1, |
+ DOUBLE = 2, |
+ ANY = 3 |
+}; |
+ |
+ |
+inline bool IsMoreGeneralStorageType(StorageType first, StorageType second) { |
+ ASSERT(second != ANY); |
+ if (first == ANY) return false; |
+ if (second == TAGGED) return false; |
+ if (first == DOUBLE) return second == SMI; |
+ return first != SMI; |
+} |
+ |
+ |
// PropertyDetails captures type and attributes for a property. |
// They are used both in property dictionaries and instance descriptors. |
class PropertyDetails BASE_EMBEDDED { |
@@ -84,6 +101,7 @@ class PropertyDetails BASE_EMBEDDED { |
PropertyType type, |
int index = 0) { |
value_ = TypeField::encode(type) |
+ | StorageTypeField::encode(TAGGED) |
| AttributesField::encode(attributes) |
| DictionaryStorageField::encode(index); |
@@ -96,6 +114,10 @@ class PropertyDetails BASE_EMBEDDED { |
PropertyDetails set_pointer(int i) { return PropertyDetails(value_, i); } |
+ PropertyDetails set_storage_type(StorageType storage) { |
+ return PropertyDetails(value_, storage); |
+ } |
+ |
// Conversion for storing details as Object*. |
explicit inline PropertyDetails(Smi* smi); |
inline Smi* AsSmi(); |
@@ -114,6 +136,10 @@ class PropertyDetails BASE_EMBEDDED { |
return DescriptorStorageField::decode(value_); |
} |
+ StorageType storage_type() { |
+ return StorageTypeField::decode(value_); |
+ } |
+ |
inline PropertyDetails AsDeleted(); |
static bool IsValidIndex(int index) { |
@@ -133,12 +159,16 @@ class PropertyDetails BASE_EMBEDDED { |
class DictionaryStorageField: public BitField<uint32_t, 7, 24> {}; |
class DescriptorStorageField: public BitField<uint32_t, 7, 11> {}; |
class DescriptorPointer: public BitField<uint32_t, 18, 11> {}; |
+ class StorageTypeField: public BitField<StorageType, 29, 2> {}; |
static const int kInitialIndex = 1; |
private: |
PropertyDetails(int value, int pointer) { |
- value_ = DescriptorPointer::update(value, pointer); |
+ value_ = DescriptorPointer::update(value, pointer); |
+ } |
+ PropertyDetails(int value, StorageType storage) { |
+ value_ = StorageTypeField::update(value, storage); |
} |
uint32_t value_; |