OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 : Descriptor(key, map, attributes, MAP_TRANSITION) { } | 108 : Descriptor(key, map, attributes, MAP_TRANSITION) { } |
109 }; | 109 }; |
110 | 110 |
111 // Marks a field name in a map so that adding the field is guaranteed | 111 // Marks a field name in a map so that adding the field is guaranteed |
112 // to create a FIELD descriptor in the new map. Used after adding | 112 // to create a FIELD descriptor in the new map. Used after adding |
113 // a constant function the first time, creating a CONSTANT_FUNCTION | 113 // a constant function the first time, creating a CONSTANT_FUNCTION |
114 // descriptor in the new map. This avoids creating multiple maps with | 114 // descriptor in the new map. This avoids creating multiple maps with |
115 // the same CONSTANT_FUNCTION field. | 115 // the same CONSTANT_FUNCTION field. |
116 class ConstTransitionDescriptor: public Descriptor { | 116 class ConstTransitionDescriptor: public Descriptor { |
117 public: | 117 public: |
118 explicit ConstTransitionDescriptor(String* key) | 118 explicit ConstTransitionDescriptor(String* key, Map* map) |
119 : Descriptor(key, Smi::FromInt(0), NONE, CONSTANT_TRANSITION) { } | 119 : Descriptor(key, map, NONE, CONSTANT_TRANSITION) { } |
120 }; | 120 }; |
121 | 121 |
122 | 122 |
123 class FieldDescriptor: public Descriptor { | 123 class FieldDescriptor: public Descriptor { |
124 public: | 124 public: |
125 FieldDescriptor(String* key, | 125 FieldDescriptor(String* key, |
126 int field_index, | 126 int field_index, |
127 PropertyAttributes attributes, | 127 PropertyAttributes attributes, |
128 int index = 0) | 128 int index = 0) |
129 : Descriptor(key, Smi::FromInt(field_index), attributes, FIELD, index) {} | 129 : Descriptor(key, Smi::FromInt(field_index), attributes, FIELD, index) {} |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 case CONSTANT_FUNCTION: | 254 case CONSTANT_FUNCTION: |
255 return GetConstantFunction(); | 255 return GetConstantFunction(); |
256 default: | 256 default: |
257 return Smi::FromInt(0); | 257 return Smi::FromInt(0); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 Map* GetTransitionMap() { | 261 Map* GetTransitionMap() { |
262 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 262 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
263 ASSERT(type() == MAP_TRANSITION); | 263 ASSERT(type() == MAP_TRANSITION || type() == CONSTANT_TRANSITION); |
264 return Map::cast(GetValue()); | 264 return Map::cast(GetValue()); |
265 } | 265 } |
266 | 266 |
267 int GetFieldIndex() { | 267 int GetFieldIndex() { |
268 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 268 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
269 ASSERT(type() == FIELD); | 269 ASSERT(type() == FIELD); |
270 return Descriptor::IndexFromValue(GetValue()); | 270 return Descriptor::IndexFromValue(GetValue()); |
271 } | 271 } |
272 | 272 |
273 int GetDictionaryEntry() { | 273 int GetDictionaryEntry() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 JSObject* holder_; | 306 JSObject* holder_; |
307 int number_; | 307 int number_; |
308 bool cacheable_; | 308 bool cacheable_; |
309 PropertyDetails details_; | 309 PropertyDetails details_; |
310 }; | 310 }; |
311 | 311 |
312 | 312 |
313 } } // namespace v8::internal | 313 } } // namespace v8::internal |
314 | 314 |
315 #endif // V8_PROPERTY_H_ | 315 #endif // V8_PROPERTY_H_ |
OLD | NEW |