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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 // Is the result a property or a transition? | 234 // Is the result a property or a transition? |
235 bool IsPropertyOrTransition() { | 235 bool IsPropertyOrTransition() { |
236 return IsFound() && (type() != NULL_DESCRIPTOR); | 236 return IsFound() && (type() != NULL_DESCRIPTOR); |
237 } | 237 } |
238 | 238 |
239 bool IsCacheable() { return cacheable_; } | 239 bool IsCacheable() { return cacheable_; } |
240 void DisallowCaching() { cacheable_ = false; } | 240 void DisallowCaching() { cacheable_ = false; } |
241 | 241 |
242 // Tells whether the value needs to be loaded. | |
243 bool IsLoaded() { | |
244 if (lookup_type_ == DESCRIPTOR_TYPE || lookup_type_ == DICTIONARY_TYPE) { | |
245 Object* target = GetLazyValue(); | |
246 return !target->IsJSObject() || JSObject::cast(target)->IsLoaded(); | |
247 } | |
248 return true; | |
249 } | |
250 | |
251 Object* GetLazyValue() { | 242 Object* GetLazyValue() { |
252 switch (type()) { | 243 switch (type()) { |
253 case FIELD: | 244 case FIELD: |
254 return holder()->FastPropertyAt(GetFieldIndex()); | 245 return holder()->FastPropertyAt(GetFieldIndex()); |
255 case NORMAL: { | 246 case NORMAL: { |
256 Object* value; | 247 Object* value; |
257 value = holder()->property_dictionary()->ValueAt(GetDictionaryEntry()); | 248 value = holder()->property_dictionary()->ValueAt(GetDictionaryEntry()); |
258 if (holder()->IsGlobalObject()) { | 249 if (holder()->IsGlobalObject()) { |
259 value = JSGlobalPropertyCell::cast(value)->value(); | 250 value = JSGlobalPropertyCell::cast(value)->value(); |
260 } | 251 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 JSObject* holder_; | 306 JSObject* holder_; |
316 int number_; | 307 int number_; |
317 bool cacheable_; | 308 bool cacheable_; |
318 PropertyDetails details_; | 309 PropertyDetails details_; |
319 }; | 310 }; |
320 | 311 |
321 | 312 |
322 } } // namespace v8::internal | 313 } } // namespace v8::internal |
323 | 314 |
324 #endif // V8_PROPERTY_H_ | 315 #endif // V8_PROPERTY_H_ |
OLD | NEW |