| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // A pointer from a map to the new map that is created by adding | 104 // A pointer from a map to the new map that is created by adding |
| 105 // a named property. These are key to the speed and functioning of V8. | 105 // a named property. These are key to the speed and functioning of V8. |
| 106 // The two maps should always have the same prototype, since | 106 // The two maps should always have the same prototype, since |
| 107 // MapSpace::CreateBackPointers depends on this. | 107 // MapSpace::CreateBackPointers depends on this. |
| 108 class MapTransitionDescriptor: public Descriptor { | 108 class MapTransitionDescriptor: public Descriptor { |
| 109 public: | 109 public: |
| 110 MapTransitionDescriptor(String* key, Map* map, PropertyAttributes attributes) | 110 MapTransitionDescriptor(String* key, Map* map, PropertyAttributes attributes) |
| 111 : Descriptor(key, map, attributes, MAP_TRANSITION) { } | 111 : Descriptor(key, map, attributes, MAP_TRANSITION) { } |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 class ElementsTransitionDescriptor: public Descriptor { | |
| 115 public: | |
| 116 ElementsTransitionDescriptor(String* key, | |
| 117 Object* map_or_array) | |
| 118 : Descriptor(key, map_or_array, PropertyDetails(NONE, | |
| 119 ELEMENTS_TRANSITION)) { } | |
| 120 }; | |
| 121 | |
| 122 // Marks a field name in a map so that adding the field is guaranteed | 114 // Marks a field name in a map so that adding the field is guaranteed |
| 123 // to create a FIELD descriptor in the new map. Used after adding | 115 // to create a FIELD descriptor in the new map. Used after adding |
| 124 // a constant function the first time, creating a CONSTANT_FUNCTION | 116 // a constant function the first time, creating a CONSTANT_FUNCTION |
| 125 // descriptor in the new map. This avoids creating multiple maps with | 117 // descriptor in the new map. This avoids creating multiple maps with |
| 126 // the same CONSTANT_FUNCTION field. | 118 // the same CONSTANT_FUNCTION field. |
| 127 class ConstTransitionDescriptor: public Descriptor { | 119 class ConstTransitionDescriptor: public Descriptor { |
| 128 public: | 120 public: |
| 129 explicit ConstTransitionDescriptor(String* key, Map* map) | 121 explicit ConstTransitionDescriptor(String* key, Map* map) |
| 130 : Descriptor(key, map, NONE, CONSTANT_TRANSITION) { } | 122 : Descriptor(key, map, NONE, CONSTANT_TRANSITION) { } |
| 131 }; | 123 }; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 case CALLBACKS: { | 165 case CALLBACKS: { |
| 174 Object* callback_object = desc->GetCallbackObject(); | 166 Object* callback_object = desc->GetCallbackObject(); |
| 175 // Non-JavaScript (i.e. native) accessors are always a property, otherwise | 167 // Non-JavaScript (i.e. native) accessors are always a property, otherwise |
| 176 // either the getter or the setter must be an accessor. Put another way: | 168 // either the getter or the setter must be an accessor. Put another way: |
| 177 // If we only see map transitions and holes in a pair, this is not a | 169 // If we only see map transitions and holes in a pair, this is not a |
| 178 // property. | 170 // property. |
| 179 return (!callback_object->IsAccessorPair() || | 171 return (!callback_object->IsAccessorPair() || |
| 180 AccessorPair::cast(callback_object)->ContainsAccessor()); | 172 AccessorPair::cast(callback_object)->ContainsAccessor()); |
| 181 } | 173 } |
| 182 case MAP_TRANSITION: | 174 case MAP_TRANSITION: |
| 183 case ELEMENTS_TRANSITION: | |
| 184 case CONSTANT_TRANSITION: | 175 case CONSTANT_TRANSITION: |
| 185 case NULL_DESCRIPTOR: | 176 case NULL_DESCRIPTOR: |
| 186 return false; | 177 return false; |
| 187 } | 178 } |
| 188 UNREACHABLE(); // keep the compiler happy | 179 UNREACHABLE(); // keep the compiler happy |
| 189 return false; | 180 return false; |
| 190 } | 181 } |
| 191 | 182 |
| 192 | 183 |
| 193 class LookupResult BASE_EMBEDDED { | 184 class LookupResult BASE_EMBEDDED { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 return GetConstantFunction(); | 295 return GetConstantFunction(); |
| 305 default: | 296 default: |
| 306 return Smi::FromInt(0); | 297 return Smi::FromInt(0); |
| 307 } | 298 } |
| 308 } | 299 } |
| 309 | 300 |
| 310 | 301 |
| 311 Map* GetTransitionMap() { | 302 Map* GetTransitionMap() { |
| 312 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 303 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| 313 ASSERT(type() == MAP_TRANSITION || | 304 ASSERT(type() == MAP_TRANSITION || |
| 314 type() == ELEMENTS_TRANSITION || | |
| 315 type() == CONSTANT_TRANSITION); | 305 type() == CONSTANT_TRANSITION); |
| 316 return Map::cast(GetValue()); | 306 return Map::cast(GetValue()); |
| 317 } | 307 } |
| 318 | 308 |
| 319 Map* GetTransitionMapFromMap(Map* map) { | 309 Map* GetTransitionMapFromMap(Map* map) { |
| 320 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 310 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| 321 ASSERT(type() == MAP_TRANSITION); | 311 ASSERT(type() == MAP_TRANSITION); |
| 322 return Map::cast(map->instance_descriptors()->GetValue(number_)); | 312 return Map::cast(map->instance_descriptors()->GetValue(number_)); |
| 323 } | 313 } |
| 324 | 314 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 JSReceiver* holder_; | 383 JSReceiver* holder_; |
| 394 int number_; | 384 int number_; |
| 395 bool cacheable_; | 385 bool cacheable_; |
| 396 PropertyDetails details_; | 386 PropertyDetails details_; |
| 397 }; | 387 }; |
| 398 | 388 |
| 399 | 389 |
| 400 } } // namespace v8::internal | 390 } } // namespace v8::internal |
| 401 | 391 |
| 402 #endif // V8_PROPERTY_H_ | 392 #endif // V8_PROPERTY_H_ |
| OLD | NEW |