| 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_DELETE, | 42 SEALED = DONT_ENUM | 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 } | |
| 188 | 183 |
| 189 // Conversion for storing details as Object*. | 184 // Conversion for storing details as Object*. |
| 190 explicit inline PropertyDetails(Smi* smi); | 185 explicit inline PropertyDetails(Smi* smi); |
| 191 inline Smi* AsSmi(); | 186 inline Smi* AsSmi(); |
| 192 | 187 |
| 193 static uint8_t EncodeRepresentation(Representation representation) { | 188 static uint8_t EncodeRepresentation(Representation representation) { |
| 194 return representation.kind(); | 189 return representation.kind(); |
| 195 } | 190 } |
| 196 | 191 |
| 197 static Representation DecodeRepresentation(uint32_t bits) { | 192 static Representation DecodeRepresentation(uint32_t bits) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 static const int kInitialIndex = 1; | 230 static const int kInitialIndex = 1; |
| 236 | 231 |
| 237 private: | 232 private: |
| 238 PropertyDetails(int value, int pointer) { | 233 PropertyDetails(int value, int pointer) { |
| 239 value_ = DescriptorPointer::update(value, pointer); | 234 value_ = DescriptorPointer::update(value, pointer); |
| 240 } | 235 } |
| 241 PropertyDetails(int value, Representation representation) { | 236 PropertyDetails(int value, Representation representation) { |
| 242 value_ = RepresentationField::update( | 237 value_ = RepresentationField::update( |
| 243 value, EncodeRepresentation(representation)); | 238 value, EncodeRepresentation(representation)); |
| 244 } | 239 } |
| 245 PropertyDetails(int value, PropertyAttributes attributes) { | |
| 246 value_ = AttributesField::update(value, attributes); | |
| 247 } | |
| 248 | 240 |
| 249 uint32_t value_; | 241 uint32_t value_; |
| 250 }; | 242 }; |
| 251 | 243 |
| 252 } } // namespace v8::internal | 244 } } // namespace v8::internal |
| 253 | 245 |
| 254 #endif // V8_PROPERTY_DETAILS_H_ | 246 #endif // V8_PROPERTY_DETAILS_H_ |
| OLD | NEW |