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 21 matching lines...) Expand all Loading... |
32 #include "allocation.h" | 32 #include "allocation.h" |
33 #include "utils.h" | 33 #include "utils.h" |
34 | 34 |
35 // Ecma-262 3rd 8.6.1 | 35 // Ecma-262 3rd 8.6.1 |
36 enum PropertyAttributes { | 36 enum PropertyAttributes { |
37 NONE = v8::None, | 37 NONE = v8::None, |
38 READ_ONLY = v8::ReadOnly, | 38 READ_ONLY = v8::ReadOnly, |
39 DONT_ENUM = v8::DontEnum, | 39 DONT_ENUM = v8::DontEnum, |
40 DONT_DELETE = v8::DontDelete, | 40 DONT_DELETE = v8::DontDelete, |
41 | 41 |
42 SEALED = DONT_ENUM | DONT_DELETE, | 42 SEALED = DONT_DELETE, |
43 FROZEN = SEALED | READ_ONLY, | 43 FROZEN = SEALED | READ_ONLY, |
44 | 44 |
45 SYMBOLIC = 8, // Used to filter symbol names | 45 SYMBOLIC = 8, // Used to filter symbol names |
46 DONT_SHOW = DONT_ENUM | SYMBOLIC, | 46 DONT_SHOW = DONT_ENUM | SYMBOLIC, |
47 ABSENT = 16 // Used in runtime to indicate a property is absent. | 47 ABSENT = 16 // Used in runtime to indicate a property is absent. |
48 // ABSENT can never be stored in or returned from a descriptor's attributes | 48 // ABSENT can never be stored in or returned from a descriptor's attributes |
49 // bitfield. It is only used as a return value meaning the attributes of | 49 // bitfield. It is only used as a return value meaning the attributes of |
50 // a non-existent property. | 50 // a non-existent property. |
51 }; | 51 }; |
52 | 52 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | RepresentationField::encode(EncodeRepresentation(representation)); | 173 | RepresentationField::encode(EncodeRepresentation(representation)); |
174 } | 174 } |
175 | 175 |
176 int pointer() { return DescriptorPointer::decode(value_); } | 176 int pointer() { return DescriptorPointer::decode(value_); } |
177 | 177 |
178 PropertyDetails set_pointer(int i) { return PropertyDetails(value_, i); } | 178 PropertyDetails set_pointer(int i) { return PropertyDetails(value_, i); } |
179 | 179 |
180 PropertyDetails CopyWithRepresentation(Representation representation) { | 180 PropertyDetails CopyWithRepresentation(Representation representation) { |
181 return PropertyDetails(value_, representation); | 181 return PropertyDetails(value_, representation); |
182 } | 182 } |
| 183 PropertyDetails CopyAddAttributes(PropertyAttributes new_attributes) { |
| 184 new_attributes = |
| 185 static_cast<PropertyAttributes>(attributes() | new_attributes); |
| 186 return PropertyDetails(value_, new_attributes); |
| 187 } |
183 | 188 |
184 // Conversion for storing details as Object*. | 189 // Conversion for storing details as Object*. |
185 explicit inline PropertyDetails(Smi* smi); | 190 explicit inline PropertyDetails(Smi* smi); |
186 inline Smi* AsSmi(); | 191 inline Smi* AsSmi(); |
187 | 192 |
188 static uint8_t EncodeRepresentation(Representation representation) { | 193 static uint8_t EncodeRepresentation(Representation representation) { |
189 return representation.kind(); | 194 return representation.kind(); |
190 } | 195 } |
191 | 196 |
192 static Representation DecodeRepresentation(uint32_t bits) { | 197 static Representation DecodeRepresentation(uint32_t bits) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 static const int kInitialIndex = 1; | 235 static const int kInitialIndex = 1; |
231 | 236 |
232 private: | 237 private: |
233 PropertyDetails(int value, int pointer) { | 238 PropertyDetails(int value, int pointer) { |
234 value_ = DescriptorPointer::update(value, pointer); | 239 value_ = DescriptorPointer::update(value, pointer); |
235 } | 240 } |
236 PropertyDetails(int value, Representation representation) { | 241 PropertyDetails(int value, Representation representation) { |
237 value_ = RepresentationField::update( | 242 value_ = RepresentationField::update( |
238 value, EncodeRepresentation(representation)); | 243 value, EncodeRepresentation(representation)); |
239 } | 244 } |
| 245 PropertyDetails(int value, PropertyAttributes attributes) { |
| 246 value_ = AttributesField::update(value, attributes); |
| 247 } |
240 | 248 |
241 uint32_t value_; | 249 uint32_t value_; |
242 }; | 250 }; |
243 | 251 |
244 } } // namespace v8::internal | 252 } } // namespace v8::internal |
245 | 253 |
246 #endif // V8_PROPERTY_DETAILS_H_ | 254 #endif // V8_PROPERTY_DETAILS_H_ |
OLD | NEW |