Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: src/property-details.h

Issue 14146005: Track representations of fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make double support consistent. Now DOUBLE always contains smi or heapnumber Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/objects.cc ('K') | « src/property.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« src/objects.cc ('K') | « src/property.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698