| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 bool IsProperty() { | 238 bool IsProperty() { |
| 239 return IsValid() && type() < FIRST_PHANTOM_PROPERTY_TYPE; | 239 return IsValid() && type() < FIRST_PHANTOM_PROPERTY_TYPE; |
| 240 } | 240 } |
| 241 | 241 |
| 242 bool IsCacheable() { return cacheable_; } | 242 bool IsCacheable() { return cacheable_; } |
| 243 void DisallowCaching() { cacheable_ = false; } | 243 void DisallowCaching() { cacheable_ = false; } |
| 244 | 244 |
| 245 // Tells whether the value needs to be loaded. | 245 // Tells whether the value needs to be loaded. |
| 246 bool IsLoaded() { | 246 bool IsLoaded() { |
| 247 if (lookup_type_ == DESCRIPTOR_TYPE || lookup_type_ == DICTIONARY_TYPE) { | 247 if (lookup_type_ == DESCRIPTOR_TYPE || lookup_type_ == DICTIONARY_TYPE) { |
| 248 Object* value = GetValue(); | 248 Object* target = GetLazyValue(); |
| 249 if (value->IsJSFunction()) { | 249 return !target->IsJSObject() || JSObject::cast(target)->IsLoaded(); |
| 250 return JSFunction::cast(value)->IsLoaded(); | |
| 251 } | |
| 252 } | 250 } |
| 253 return true; | 251 return true; |
| 254 } | 252 } |
| 255 | 253 |
| 254 Object* GetLazyValue() { |
| 255 switch (type()) { |
| 256 case FIELD: |
| 257 return holder()->FastPropertyAt(GetFieldIndex()); |
| 258 case NORMAL: |
| 259 return holder()->property_dictionary()->ValueAt(GetDictionaryEntry()); |
| 260 case CONSTANT_FUNCTION: |
| 261 return GetConstantFunction(); |
| 262 default: |
| 263 return Smi::FromInt(0); |
| 264 } |
| 265 } |
| 266 |
| 256 Map* GetTransitionMap() { | 267 Map* GetTransitionMap() { |
| 257 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 268 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| 258 ASSERT(type() == MAP_TRANSITION); | 269 ASSERT(type() == MAP_TRANSITION); |
| 259 return Map::cast(GetValue()); | 270 return Map::cast(GetValue()); |
| 260 } | 271 } |
| 261 | 272 |
| 262 int GetFieldIndex() { | 273 int GetFieldIndex() { |
| 263 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); | 274 ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| 264 ASSERT(type() == FIELD); | 275 ASSERT(type() == FIELD); |
| 265 return Descriptor::IndexFromValue(GetValue()); | 276 return Descriptor::IndexFromValue(GetValue()); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 398 |
| 388 // Append a descriptor to this stream. | 399 // Append a descriptor to this stream. |
| 389 void Write(Descriptor* desc); | 400 void Write(Descriptor* desc); |
| 390 // Read a descriptor from the reader and append it to this stream. | 401 // Read a descriptor from the reader and append it to this stream. |
| 391 void WriteFrom(DescriptorReader* reader); | 402 void WriteFrom(DescriptorReader* reader); |
| 392 }; | 403 }; |
| 393 | 404 |
| 394 } } // namespace v8::internal | 405 } } // namespace v8::internal |
| 395 | 406 |
| 396 #endif // V8_PROPERTY_H_ | 407 #endif // V8_PROPERTY_H_ |
| OLD | NEW |