| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef V8_PROPERTY_DETAILS_H_ | 5 #ifndef V8_PROPERTY_DETAILS_H_ | 
| 6 #define V8_PROPERTY_DETAILS_H_ | 6 #define V8_PROPERTY_DETAILS_H_ | 
| 7 | 7 | 
| 8 #include "include/v8.h" | 8 #include "include/v8.h" | 
| 9 #include "src/allocation.h" | 9 #include "src/allocation.h" | 
| 10 #include "src/utils.h" | 10 #include "src/utils.h" | 
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 225 enum class PropertyCellConstantType { | 225 enum class PropertyCellConstantType { | 
| 226   kSmi, | 226   kSmi, | 
| 227   kStableMap, | 227   kStableMap, | 
| 228 }; | 228 }; | 
| 229 | 229 | 
| 230 | 230 | 
| 231 // PropertyDetails captures type and attributes for a property. | 231 // PropertyDetails captures type and attributes for a property. | 
| 232 // They are used both in property dictionaries and instance descriptors. | 232 // They are used both in property dictionaries and instance descriptors. | 
| 233 class PropertyDetails BASE_EMBEDDED { | 233 class PropertyDetails BASE_EMBEDDED { | 
| 234  public: | 234  public: | 
| 235   PropertyDetails(PropertyAttributes attributes, PropertyType type, int index, | 235   // Property details for dictionary mode properties/elements. | 
|  | 236   PropertyDetails(PropertyKind kind, PropertyAttributes attributes, int index, | 
| 236                   PropertyCellType cell_type) { | 237                   PropertyCellType cell_type) { | 
| 237     value_ = TypeField::encode(type) | AttributesField::encode(attributes) | | 238     value_ = KindField::encode(kind) | LocationField::encode(kField) | | 
|  | 239              AttributesField::encode(attributes) | | 
| 238              DictionaryStorageField::encode(index) | | 240              DictionaryStorageField::encode(index) | | 
| 239              PropertyCellTypeField::encode(cell_type); | 241              PropertyCellTypeField::encode(cell_type); | 
| 240 |  | 
| 241     DCHECK(type == this->type()); |  | 
| 242     DCHECK(attributes == this->attributes()); |  | 
| 243   } | 242   } | 
| 244 | 243 | 
| 245   PropertyDetails(PropertyAttributes attributes, | 244   // Property details for fast mode properties. | 
| 246                   PropertyType type, |  | 
| 247                   Representation representation, |  | 
| 248                   int field_index = 0) { |  | 
| 249     value_ = TypeField::encode(type) |  | 
| 250         | AttributesField::encode(attributes) |  | 
| 251         | RepresentationField::encode(EncodeRepresentation(representation)) |  | 
| 252         | FieldIndexField::encode(field_index); |  | 
| 253   } |  | 
| 254 |  | 
| 255   PropertyDetails(PropertyKind kind, PropertyAttributes attributes, | 245   PropertyDetails(PropertyKind kind, PropertyAttributes attributes, | 
| 256                   PropertyLocation location, Representation representation, | 246                   PropertyLocation location, Representation representation, | 
| 257                   int field_index = 0) { | 247                   int field_index = 0) { | 
| 258     value_ = KindField::encode(kind) | LocationField::encode(location) | | 248     value_ = KindField::encode(kind) | LocationField::encode(location) | | 
| 259              AttributesField::encode(attributes) | | 249              AttributesField::encode(attributes) | | 
| 260              RepresentationField::encode(EncodeRepresentation(representation)) | | 250              RepresentationField::encode(EncodeRepresentation(representation)) | | 
| 261              FieldIndexField::encode(field_index); | 251              FieldIndexField::encode(field_index); | 
| 262   } | 252   } | 
| 263 | 253 | 
| 264   static PropertyDetails Empty( | 254   static PropertyDetails Empty( | 
| 265       PropertyCellType cell_type = PropertyCellType::kNoCell) { | 255       PropertyCellType cell_type = PropertyCellType::kNoCell) { | 
| 266     return PropertyDetails(NONE, DATA, 0, cell_type); | 256     return PropertyDetails(kData, NONE, 0, cell_type); | 
| 267   } | 257   } | 
| 268 | 258 | 
| 269   int pointer() const { return DescriptorPointer::decode(value_); } | 259   int pointer() const { return DescriptorPointer::decode(value_); } | 
| 270 | 260 | 
| 271   PropertyDetails set_pointer(int i) const { | 261   PropertyDetails set_pointer(int i) const { | 
| 272     return PropertyDetails(value_, i); | 262     return PropertyDetails(value_, i); | 
| 273   } | 263   } | 
| 274 | 264 | 
| 275   PropertyDetails set_cell_type(PropertyCellType type) const { | 265   PropertyDetails set_cell_type(PropertyCellType type) const { | 
| 276     PropertyDetails details = *this; | 266     PropertyDetails details = *this; | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 403   uint32_t value_; | 393   uint32_t value_; | 
| 404 }; | 394 }; | 
| 405 | 395 | 
| 406 | 396 | 
| 407 std::ostream& operator<<(std::ostream& os, | 397 std::ostream& operator<<(std::ostream& os, | 
| 408                          const PropertyAttributes& attributes); | 398                          const PropertyAttributes& attributes); | 
| 409 }  // namespace internal | 399 }  // namespace internal | 
| 410 }  // namespace v8 | 400 }  // namespace v8 | 
| 411 | 401 | 
| 412 #endif  // V8_PROPERTY_DETAILS_H_ | 402 #endif  // V8_PROPERTY_DETAILS_H_ | 
| OLD | NEW | 
|---|