| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // A pointer from a map to the new map that is created by adding | 105 // A pointer from a map to the new map that is created by adding |
| 106 // a named property. These are key to the speed and functioning of V8. | 106 // a named property. These are key to the speed and functioning of V8. |
| 107 // The two maps should always have the same prototype, since | 107 // The two maps should always have the same prototype, since |
| 108 // MapSpace::CreateBackPointers depends on this. | 108 // MapSpace::CreateBackPointers depends on this. |
| 109 class MapTransitionDescriptor: public Descriptor { | 109 class MapTransitionDescriptor: public Descriptor { |
| 110 public: | 110 public: |
| 111 MapTransitionDescriptor(String* key, Map* map, PropertyAttributes attributes) | 111 MapTransitionDescriptor(String* key, Map* map, PropertyAttributes attributes) |
| 112 : Descriptor(key, map, attributes, MAP_TRANSITION) { } | 112 : Descriptor(key, map, attributes, MAP_TRANSITION) { } |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 class ExternalArrayTransitionDescriptor: public Descriptor { | 115 class ElementsTransitionDescriptor: public Descriptor { |
| 116 public: | 116 public: |
| 117 ExternalArrayTransitionDescriptor(String* key, | 117 ElementsTransitionDescriptor(String* key, |
| 118 Map* map, | 118 Map* map, |
| 119 ExternalArrayType array_type) | 119 ElementsKind elements_kind) |
| 120 : Descriptor(key, map, PropertyDetails(NONE, | 120 : Descriptor(key, map, PropertyDetails(NONE, |
| 121 EXTERNAL_ARRAY_TRANSITION, | 121 ELEMENTS_TRANSITION, |
| 122 array_type)) { } | 122 elements_kind)) { } |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 // Marks a field name in a map so that adding the field is guaranteed | 125 // Marks a field name in a map so that adding the field is guaranteed |
| 126 // to create a FIELD descriptor in the new map. Used after adding | 126 // to create a FIELD descriptor in the new map. Used after adding |
| 127 // a constant function the first time, creating a CONSTANT_FUNCTION | 127 // a constant function the first time, creating a CONSTANT_FUNCTION |
| 128 // descriptor in the new map. This avoids creating multiple maps with | 128 // descriptor in the new map. This avoids creating multiple maps with |
| 129 // the same CONSTANT_FUNCTION field. | 129 // the same CONSTANT_FUNCTION field. |
| 130 class ConstTransitionDescriptor: public Descriptor { | 130 class ConstTransitionDescriptor: public Descriptor { |
| 131 public: | 131 public: |
| 132 explicit ConstTransitionDescriptor(String* key, Map* map) | 132 explicit ConstTransitionDescriptor(String* key, Map* map) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 case CONSTANT_FUNCTION: | 274 case CONSTANT_FUNCTION: |
| 275 return GetConstantFunction(); | 275 return GetConstantFunction(); |
| 276 default: | 276 default: |
| 277 return Smi::FromInt(0); | 277 return Smi::FromInt(0); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 Map* GetTransitionMap() { | 281 Map* GetTransitionMap() { |
| 282 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 282 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| 283 ASSERT(type() == MAP_TRANSITION || type() == CONSTANT_TRANSITION || | 283 ASSERT(type() == MAP_TRANSITION || type() == CONSTANT_TRANSITION || |
| 284 type() == EXTERNAL_ARRAY_TRANSITION); | 284 type() == ELEMENTS_TRANSITION); |
| 285 return Map::cast(GetValue()); | 285 return Map::cast(GetValue()); |
| 286 } | 286 } |
| 287 | 287 |
| 288 Map* GetTransitionMapFromMap(Map* map) { | 288 Map* GetTransitionMapFromMap(Map* map) { |
| 289 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 289 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| 290 ASSERT(type() == MAP_TRANSITION); | 290 ASSERT(type() == MAP_TRANSITION); |
| 291 return Map::cast(map->instance_descriptors()->GetValue(number_)); | 291 return Map::cast(map->instance_descriptors()->GetValue(number_)); |
| 292 } | 292 } |
| 293 | 293 |
| 294 int GetFieldIndex() { | 294 int GetFieldIndex() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 JSObject* holder_; | 357 JSObject* holder_; |
| 358 int number_; | 358 int number_; |
| 359 bool cacheable_; | 359 bool cacheable_; |
| 360 PropertyDetails details_; | 360 PropertyDetails details_; |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 | 363 |
| 364 } } // namespace v8::internal | 364 } } // namespace v8::internal |
| 365 | 365 |
| 366 #endif // V8_PROPERTY_H_ | 366 #endif // V8_PROPERTY_H_ |
| OLD | NEW |