OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int pointer() { return DescriptorPointer::decode(value_); } | 89 int pointer() { return DescriptorPointer::decode(value_); } |
90 | 90 |
91 PropertyDetails set_pointer(int i) { return PropertyDetails(value_, i); } | 91 PropertyDetails set_pointer(int i) { return PropertyDetails(value_, i); } |
92 | 92 |
93 // Conversion for storing details as Object*. | 93 // Conversion for storing details as Object*. |
94 explicit inline PropertyDetails(Smi* smi); | 94 explicit inline PropertyDetails(Smi* smi); |
95 inline Smi* AsSmi(); | 95 inline Smi* AsSmi(); |
96 | 96 |
97 PropertyType type() { return TypeField::decode(value_); } | 97 PropertyType type() { return TypeField::decode(value_); } |
98 | 98 |
99 PropertyAttributes attributes() { return AttributesField::decode(value_); } | 99 PropertyAttributes attributes() const { |
| 100 return AttributesField::decode(value_); |
| 101 } |
100 | 102 |
101 int dictionary_index() { | 103 int dictionary_index() { |
102 return DictionaryStorageField::decode(value_); | 104 return DictionaryStorageField::decode(value_); |
103 } | 105 } |
104 | 106 |
105 int descriptor_index() { | 107 int descriptor_index() { |
106 return DescriptorStorageField::decode(value_); | 108 return DescriptorStorageField::decode(value_); |
107 } | 109 } |
108 | 110 |
109 inline PropertyDetails AsDeleted(); | 111 inline PropertyDetails AsDeleted(); |
110 | 112 |
111 static bool IsValidIndex(int index) { | 113 static bool IsValidIndex(int index) { |
112 return DictionaryStorageField::is_valid(index); | 114 return DictionaryStorageField::is_valid(index); |
113 } | 115 } |
114 | 116 |
115 bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; } | 117 bool IsReadOnly() const { return (attributes() & READ_ONLY) != 0; } |
116 bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; } | 118 bool IsDontDelete() const { return (attributes() & DONT_DELETE) != 0; } |
117 bool IsDontEnum() { return (attributes() & DONT_ENUM) != 0; } | 119 bool IsDontEnum() const { return (attributes() & DONT_ENUM) != 0; } |
118 bool IsDeleted() { return DeletedField::decode(value_) != 0;} | 120 bool IsDeleted() const { return DeletedField::decode(value_) != 0;} |
119 | 121 |
120 // Bit fields in value_ (type, shift, size). Must be public so the | 122 // Bit fields in value_ (type, shift, size). Must be public so the |
121 // constants can be embedded in generated code. | 123 // constants can be embedded in generated code. |
122 class TypeField: public BitField<PropertyType, 0, 3> {}; | 124 class TypeField: public BitField<PropertyType, 0, 3> {}; |
123 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; | 125 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; |
124 class DeletedField: public BitField<uint32_t, 6, 1> {}; | 126 class DeletedField: public BitField<uint32_t, 6, 1> {}; |
125 class DictionaryStorageField: public BitField<uint32_t, 7, 24> {}; | 127 class DictionaryStorageField: public BitField<uint32_t, 7, 24> {}; |
126 class DescriptorStorageField: public BitField<uint32_t, 7, 11> {}; | 128 class DescriptorStorageField: public BitField<uint32_t, 7, 11> {}; |
127 class DescriptorPointer: public BitField<uint32_t, 18, 11> {}; | 129 class DescriptorPointer: public BitField<uint32_t, 18, 11> {}; |
128 | 130 |
129 static const int kInitialIndex = 1; | 131 static const int kInitialIndex = 1; |
130 | 132 |
131 private: | 133 private: |
132 PropertyDetails(int value, int pointer) { | 134 PropertyDetails(int value, int pointer) { |
133 value_ = DescriptorPointer::update(value, pointer); | 135 value_ = DescriptorPointer::update(value, pointer); |
134 } | 136 } |
135 | 137 |
136 uint32_t value_; | 138 uint32_t value_; |
137 }; | 139 }; |
138 | 140 |
139 } } // namespace v8::internal | 141 } } // namespace v8::internal |
140 | 142 |
141 #endif // V8_PROPERTY_DETAILS_H_ | 143 #endif // V8_PROPERTY_DETAILS_H_ |
OLD | NEW |