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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 namespace v8 { | 48 namespace v8 { |
49 namespace internal { | 49 namespace internal { |
50 | 50 |
51 class Smi; | 51 class Smi; |
52 | 52 |
53 // Type of properties. | 53 // Type of properties. |
54 // Order of properties is significant. | 54 // Order of properties is significant. |
55 // Must fit in the BitField PropertyDetails::TypeField. | 55 // Must fit in the BitField PropertyDetails::TypeField. |
56 // A copy of this is in mirror-debugger.js. | 56 // A copy of this is in mirror-debugger.js. |
57 enum PropertyType { | 57 enum PropertyType { |
58 NORMAL = 0, // only in slow mode | 58 // Only in slow mode. |
59 FIELD = 1, // only in fast mode | 59 NORMAL = 0, |
60 CONSTANT_FUNCTION = 2, // only in fast mode | 60 // Only in fast mode. |
| 61 FIELD = 1, |
| 62 CONSTANT_FUNCTION = 2, |
61 CALLBACKS = 3, | 63 CALLBACKS = 3, |
62 HANDLER = 4, // only in lookup results, not in descriptors | 64 // Only in lookup results, not in descriptors. |
63 INTERCEPTOR = 5, // only in lookup results, not in descriptors | 65 HANDLER = 4, |
64 // All properties before MAP_TRANSITION are real. | 66 INTERCEPTOR = 5, |
65 MAP_TRANSITION = 6, // only in fast mode | 67 TRANSITION = 6, |
66 CONSTANT_TRANSITION = 7, // only in fast mode | |
67 // Only used as a marker in LookupResult. | 68 // Only used as a marker in LookupResult. |
68 NONEXISTENT = 8 | 69 NONEXISTENT = 7 |
69 }; | 70 }; |
70 | 71 |
71 | 72 |
72 // PropertyDetails captures type and attributes for a property. | 73 // PropertyDetails captures type and attributes for a property. |
73 // They are used both in property dictionaries and instance descriptors. | 74 // They are used both in property dictionaries and instance descriptors. |
74 class PropertyDetails BASE_EMBEDDED { | 75 class PropertyDetails BASE_EMBEDDED { |
75 public: | 76 public: |
76 PropertyDetails(PropertyAttributes attributes, | 77 PropertyDetails(PropertyAttributes attributes, |
77 PropertyType type, | 78 PropertyType type, |
78 int index = 0) { | 79 int index = 0) { |
(...skipping 26 matching lines...) Expand all Loading... |
105 return StorageField::is_valid(index); | 106 return StorageField::is_valid(index); |
106 } | 107 } |
107 | 108 |
108 bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; } | 109 bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; } |
109 bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; } | 110 bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; } |
110 bool IsDontEnum() { return (attributes() & DONT_ENUM) != 0; } | 111 bool IsDontEnum() { return (attributes() & DONT_ENUM) != 0; } |
111 bool IsDeleted() { return DeletedField::decode(value_) != 0;} | 112 bool IsDeleted() { return DeletedField::decode(value_) != 0;} |
112 | 113 |
113 // Bit fields in value_ (type, shift, size). Must be public so the | 114 // Bit fields in value_ (type, shift, size). Must be public so the |
114 // constants can be embedded in generated code. | 115 // constants can be embedded in generated code. |
115 class TypeField: public BitField<PropertyType, 0, 4> {}; | 116 class TypeField: public BitField<PropertyType, 0, 3> {}; |
116 class AttributesField: public BitField<PropertyAttributes, 4, 3> {}; | 117 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; |
117 class DeletedField: public BitField<uint32_t, 7, 1> {}; | 118 class DeletedField: public BitField<uint32_t, 6, 1> {}; |
118 class StorageField: public BitField<uint32_t, 8, 32-8> {}; | 119 class StorageField: public BitField<uint32_t, 7, 32-7> {}; |
119 | 120 |
120 static const int kInitialIndex = 1; | 121 static const int kInitialIndex = 1; |
121 | 122 |
122 private: | 123 private: |
123 uint32_t value_; | 124 uint32_t value_; |
124 }; | 125 }; |
125 | 126 |
126 } } // namespace v8::internal | 127 } } // namespace v8::internal |
127 | 128 |
128 #endif // V8_PROPERTY_DETAILS_H_ | 129 #endif // V8_PROPERTY_DETAILS_H_ |
OLD | NEW |