| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Type of properties. | 43 // Type of properties. |
| 44 // Order of properties is significant. | 44 // Order of properties is significant. |
| 45 // Must fit in the BitField PropertyDetails::TypeField. | 45 // Must fit in the BitField PropertyDetails::TypeField. |
| 46 // A copy of this is in mirror-debugger.js. | 46 // A copy of this is in mirror-debugger.js. |
| 47 enum PropertyType { | 47 enum PropertyType { |
| 48 // Only in slow mode. | 48 // Only in slow mode. |
| 49 NORMAL = 0, | 49 NORMAL = 0, |
| 50 // Only in fast mode. | 50 // Only in fast mode. |
| 51 FIELD = 1, | 51 FIELD = 1, |
| 52 CONSTANT = 2, | 52 CONSTANT = 2, |
| 53 CALLBACKS = 3, | 53 CALLBACKS = 3 |
| 54 // Only in lookup results, not in descriptors. | |
| 55 HANDLER = 4, | |
| 56 INTERCEPTOR = 5 | |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 | 56 |
| 60 class Representation { | 57 class Representation { |
| 61 public: | 58 public: |
| 62 enum Kind { | 59 enum Kind { |
| 63 kNone, | 60 kNone, |
| 64 kInteger8, | 61 kInteger8, |
| 65 kUInteger8, | 62 kUInteger8, |
| 66 kInteger16, | 63 kInteger16, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 return DictionaryStorageField::is_valid(index); | 254 return DictionaryStorageField::is_valid(index); |
| 258 } | 255 } |
| 259 | 256 |
| 260 bool IsReadOnly() const { return (attributes() & READ_ONLY) != 0; } | 257 bool IsReadOnly() const { return (attributes() & READ_ONLY) != 0; } |
| 261 bool IsConfigurable() const { return (attributes() & DONT_DELETE) == 0; } | 258 bool IsConfigurable() const { return (attributes() & DONT_DELETE) == 0; } |
| 262 bool IsDontEnum() const { return (attributes() & DONT_ENUM) != 0; } | 259 bool IsDontEnum() const { return (attributes() & DONT_ENUM) != 0; } |
| 263 bool IsDeleted() const { return DeletedField::decode(value_) != 0;} | 260 bool IsDeleted() const { return DeletedField::decode(value_) != 0;} |
| 264 | 261 |
| 265 // Bit fields in value_ (type, shift, size). Must be public so the | 262 // Bit fields in value_ (type, shift, size). Must be public so the |
| 266 // constants can be embedded in generated code. | 263 // constants can be embedded in generated code. |
| 267 class TypeField: public BitField<PropertyType, 0, 3> {}; | 264 class TypeField : public BitField<PropertyType, 0, 2> {}; |
| 268 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; | 265 class AttributesField : public BitField<PropertyAttributes, 2, 3> {}; |
| 269 | 266 |
| 270 // Bit fields for normalized objects. | 267 // Bit fields for normalized objects. |
| 271 class DeletedField: public BitField<uint32_t, 6, 1> {}; | 268 class DeletedField : public BitField<uint32_t, 5, 1> {}; |
| 272 class DictionaryStorageField: public BitField<uint32_t, 7, 24> {}; | 269 class DictionaryStorageField : public BitField<uint32_t, 6, 24> {}; |
| 273 | 270 |
| 274 // Bit fields for fast objects. | 271 // Bit fields for fast objects. |
| 275 class RepresentationField: public BitField<uint32_t, 6, 4> {}; | 272 class RepresentationField : public BitField<uint32_t, 5, 4> {}; |
| 276 class DescriptorPointer: public BitField<uint32_t, 10, | 273 class DescriptorPointer |
| 277 kDescriptorIndexBitCount> {}; // NOLINT | 274 : public BitField<uint32_t, 9, kDescriptorIndexBitCount> {}; // NOLINT |
| 278 class FieldIndexField: public BitField<uint32_t, | 275 class FieldIndexField |
| 279 10 + kDescriptorIndexBitCount, | 276 : public BitField<uint32_t, 9 + kDescriptorIndexBitCount, |
| 280 kDescriptorIndexBitCount> {}; // NOLINT | 277 kDescriptorIndexBitCount> {}; // NOLINT |
| 281 // All bits for fast objects must fix in a smi. | 278 // All bits for fast objects must fix in a smi. |
| 282 STATIC_ASSERT(10 + kDescriptorIndexBitCount + kDescriptorIndexBitCount <= 31); | 279 STATIC_ASSERT(9 + kDescriptorIndexBitCount + kDescriptorIndexBitCount <= 31); |
| 283 | 280 |
| 284 static const int kInitialIndex = 1; | 281 static const int kInitialIndex = 1; |
| 285 | 282 |
| 286 private: | 283 private: |
| 287 PropertyDetails(int value, int pointer) { | 284 PropertyDetails(int value, int pointer) { |
| 288 value_ = DescriptorPointer::update(value, pointer); | 285 value_ = DescriptorPointer::update(value, pointer); |
| 289 } | 286 } |
| 290 PropertyDetails(int value, Representation representation) { | 287 PropertyDetails(int value, Representation representation) { |
| 291 value_ = RepresentationField::update( | 288 value_ = RepresentationField::update( |
| 292 value, EncodeRepresentation(representation)); | 289 value, EncodeRepresentation(representation)); |
| 293 } | 290 } |
| 294 PropertyDetails(int value, PropertyAttributes attributes) { | 291 PropertyDetails(int value, PropertyAttributes attributes) { |
| 295 value_ = AttributesField::update(value, attributes); | 292 value_ = AttributesField::update(value, attributes); |
| 296 } | 293 } |
| 297 | 294 |
| 298 uint32_t value_; | 295 uint32_t value_; |
| 299 }; | 296 }; |
| 300 | 297 |
| 301 } } // namespace v8::internal | 298 } } // namespace v8::internal |
| 302 | 299 |
| 303 #endif // V8_PROPERTY_DETAILS_H_ | 300 #endif // V8_PROPERTY_DETAILS_H_ |
| OLD | NEW |