| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 // Tells whether the result is a property. | 236 // Tells whether the result is a property. |
| 237 // Excluding transitions and the null descriptor. | 237 // Excluding transitions and the null descriptor. |
| 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. | |
| 246 bool IsLoaded() { | |
| 247 if (lookup_type_ == DESCRIPTOR_TYPE || lookup_type_ == DICTIONARY_TYPE) { | |
| 248 Object* target = GetLazyValue(); | |
| 249 return !target->IsJSObject() || JSObject::cast(target)->IsLoaded(); | |
| 250 } | |
| 251 return true; | |
| 252 } | |
| 253 | |
| 254 Object* GetLazyValue() { | 245 Object* GetLazyValue() { |
| 255 switch (type()) { | 246 switch (type()) { |
| 256 case FIELD: | 247 case FIELD: |
| 257 return holder()->FastPropertyAt(GetFieldIndex()); | 248 return holder()->FastPropertyAt(GetFieldIndex()); |
| 258 case NORMAL: { | 249 case NORMAL: { |
| 259 Object* value; | 250 Object* value; |
| 260 value = holder()->property_dictionary()->ValueAt(GetDictionaryEntry()); | 251 value = holder()->property_dictionary()->ValueAt(GetDictionaryEntry()); |
| 261 if (holder()->IsGlobalObject()) { | 252 if (holder()->IsGlobalObject()) { |
| 262 value = JSGlobalPropertyCell::cast(value)->value(); | 253 value = JSGlobalPropertyCell::cast(value)->value(); |
| 263 } | 254 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 JSObject* holder_; | 309 JSObject* holder_; |
| 319 int number_; | 310 int number_; |
| 320 bool cacheable_; | 311 bool cacheable_; |
| 321 PropertyDetails details_; | 312 PropertyDetails details_; |
| 322 }; | 313 }; |
| 323 | 314 |
| 324 | 315 |
| 325 } } // namespace v8::internal | 316 } } // namespace v8::internal |
| 326 | 317 |
| 327 #endif // V8_PROPERTY_H_ | 318 #endif // V8_PROPERTY_H_ |
| OLD | NEW |