| OLD | NEW |
| 1 // Copyright 2011 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 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ElementsTransitionDescriptor: public Descriptor { | 115 class ElementsTransitionDescriptor: public Descriptor { |
| 116 public: | 116 public: |
| 117 ElementsTransitionDescriptor(String* key, | 117 ElementsTransitionDescriptor(String* key, |
| 118 Map* map, | 118 Object* map_or_array) |
| 119 ElementsKind elements_kind) | 119 : Descriptor(key, map_or_array, PropertyDetails(NONE, |
| 120 : Descriptor(key, map, PropertyDetails(NONE, | 120 ELEMENTS_TRANSITION)) { } |
| 121 ELEMENTS_TRANSITION, | |
| 122 elements_kind)) { } | |
| 123 }; | 121 }; |
| 124 | 122 |
| 125 // Marks a field name in a map so that adding the field is guaranteed | 123 // 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 | 124 // to create a FIELD descriptor in the new map. Used after adding |
| 127 // a constant function the first time, creating a CONSTANT_FUNCTION | 125 // a constant function the first time, creating a CONSTANT_FUNCTION |
| 128 // descriptor in the new map. This avoids creating multiple maps with | 126 // descriptor in the new map. This avoids creating multiple maps with |
| 129 // the same CONSTANT_FUNCTION field. | 127 // the same CONSTANT_FUNCTION field. |
| 130 class ConstTransitionDescriptor: public Descriptor { | 128 class ConstTransitionDescriptor: public Descriptor { |
| 131 public: | 129 public: |
| 132 explicit ConstTransitionDescriptor(String* key, Map* map) | 130 explicit ConstTransitionDescriptor(String* key, Map* map) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 number_ = -1; | 193 number_ = -1; |
| 196 } | 194 } |
| 197 | 195 |
| 198 void DictionaryResult(JSObject* holder, int entry) { | 196 void DictionaryResult(JSObject* holder, int entry) { |
| 199 lookup_type_ = DICTIONARY_TYPE; | 197 lookup_type_ = DICTIONARY_TYPE; |
| 200 holder_ = holder; | 198 holder_ = holder; |
| 201 details_ = holder->property_dictionary()->DetailsAt(entry); | 199 details_ = holder->property_dictionary()->DetailsAt(entry); |
| 202 number_ = entry; | 200 number_ = entry; |
| 203 } | 201 } |
| 204 | 202 |
| 205 void HandlerResult() { | 203 void HandlerResult(JSProxy* proxy) { |
| 206 lookup_type_ = HANDLER_TYPE; | 204 lookup_type_ = HANDLER_TYPE; |
| 207 holder_ = NULL; | 205 holder_ = proxy; |
| 208 details_ = PropertyDetails(NONE, HANDLER); | 206 details_ = PropertyDetails(NONE, HANDLER); |
| 209 cacheable_ = false; | 207 cacheable_ = false; |
| 210 } | 208 } |
| 211 | 209 |
| 212 void InterceptorResult(JSObject* holder) { | 210 void InterceptorResult(JSObject* holder) { |
| 213 lookup_type_ = INTERCEPTOR_TYPE; | 211 lookup_type_ = INTERCEPTOR_TYPE; |
| 214 holder_ = holder; | 212 holder_ = holder; |
| 215 details_ = PropertyDetails(NONE, INTERCEPTOR); | 213 details_ = PropertyDetails(NONE, INTERCEPTOR); |
| 216 } | 214 } |
| 217 | 215 |
| 218 void NotFound() { | 216 void NotFound() { |
| 219 lookup_type_ = NOT_FOUND; | 217 lookup_type_ = NOT_FOUND; |
| 220 } | 218 } |
| 221 | 219 |
| 222 JSObject* holder() { | 220 JSObject* holder() { |
| 223 ASSERT(IsFound()); | 221 ASSERT(IsFound()); |
| 224 return holder_; | 222 return JSObject::cast(holder_); |
| 223 } |
| 224 |
| 225 JSProxy* proxy() { |
| 226 ASSERT(IsFound()); |
| 227 return JSProxy::cast(holder_); |
| 225 } | 228 } |
| 226 | 229 |
| 227 PropertyType type() { | 230 PropertyType type() { |
| 228 ASSERT(IsFound()); | 231 ASSERT(IsFound()); |
| 229 return details_.type(); | 232 return details_.type(); |
| 230 } | 233 } |
| 231 | 234 |
| 232 PropertyAttributes GetAttributes() { | 235 PropertyAttributes GetAttributes() { |
| 233 ASSERT(IsFound()); | 236 ASSERT(IsFound()); |
| 234 return details_.attributes(); | 237 return details_.attributes(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // Where did we find the result; | 350 // Where did we find the result; |
| 348 enum { | 351 enum { |
| 349 NOT_FOUND, | 352 NOT_FOUND, |
| 350 DESCRIPTOR_TYPE, | 353 DESCRIPTOR_TYPE, |
| 351 DICTIONARY_TYPE, | 354 DICTIONARY_TYPE, |
| 352 HANDLER_TYPE, | 355 HANDLER_TYPE, |
| 353 INTERCEPTOR_TYPE, | 356 INTERCEPTOR_TYPE, |
| 354 CONSTANT_TYPE | 357 CONSTANT_TYPE |
| 355 } lookup_type_; | 358 } lookup_type_; |
| 356 | 359 |
| 357 JSObject* holder_; | 360 JSReceiver* holder_; |
| 358 int number_; | 361 int number_; |
| 359 bool cacheable_; | 362 bool cacheable_; |
| 360 PropertyDetails details_; | 363 PropertyDetails details_; |
| 361 }; | 364 }; |
| 362 | 365 |
| 363 | 366 |
| 364 } } // namespace v8::internal | 367 } } // namespace v8::internal |
| 365 | 368 |
| 366 #endif // V8_PROPERTY_H_ | 369 #endif // V8_PROPERTY_H_ |
| OLD | NEW |