OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 Handle<Object> GetHiddenProperties(Handle<JSObject> obj, | 274 Handle<Object> GetHiddenProperties(Handle<JSObject> obj, |
275 bool create_if_needed) { | 275 bool create_if_needed) { |
276 Handle<String> key = Factory::hidden_symbol(); | 276 Handle<String> key = Factory::hidden_symbol(); |
277 | 277 |
278 if (obj->HasFastProperties()) { | 278 if (obj->HasFastProperties()) { |
279 // If the object has fast properties, check whether the first slot | 279 // If the object has fast properties, check whether the first slot |
280 // in the descriptor array matches the hidden symbol. Since the | 280 // in the descriptor array matches the hidden symbol. Since the |
281 // hidden symbols hash code is zero (and no other string has hash | 281 // hidden symbols hash code is zero (and no other string has hash |
282 // code zero) it will always occupy the first entry if present. | 282 // code zero) it will always occupy the first entry if present. |
283 DescriptorArray* descriptors = obj->map()->instance_descriptors(); | 283 DescriptorArray* descriptors = obj->map()->instance_descriptors(); |
284 DescriptorReader r(descriptors); | 284 DescriptorReader r(descriptors, 0); // Explicitly position reader at zero. |
285 if (!r.eos() && (r.GetKey() == *key) && r.IsProperty()) { | 285 if (!r.eos() && (r.GetKey() == *key) && r.IsProperty()) { |
286 ASSERT(r.type() == FIELD); | 286 ASSERT(r.type() == FIELD); |
287 return Handle<Object>(obj->FastPropertyAt(r.GetFieldIndex())); | 287 return Handle<Object>(obj->FastPropertyAt(r.GetFieldIndex())); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 // Only attempt to find the hidden properties in the local object and not | 291 // Only attempt to find the hidden properties in the local object and not |
292 // in the prototype chain. Note that HasLocalProperty() can cause a GC in | 292 // in the prototype chain. Note that HasLocalProperty() can cause a GC in |
293 // the general case in the presence of interceptors. | 293 // the general case in the presence of interceptors. |
294 if (!obj->HasLocalProperty(*key)) { | 294 if (!obj->HasLocalProperty(*key)) { |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); | 731 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); |
732 obj->set_map(*new_map); | 732 obj->set_map(*new_map); |
733 new_map->set_needs_loading(true); | 733 new_map->set_needs_loading(true); |
734 // Store the lazy loading info in the constructor field. We'll | 734 // Store the lazy loading info in the constructor field. We'll |
735 // reestablish the constructor from the fixed array after loading. | 735 // reestablish the constructor from the fixed array after loading. |
736 new_map->set_constructor(*arr); | 736 new_map->set_constructor(*arr); |
737 ASSERT(!obj->IsLoaded()); | 737 ASSERT(!obj->IsLoaded()); |
738 } | 738 } |
739 | 739 |
740 } } // namespace v8::internal | 740 } } // namespace v8::internal |
OLD | NEW |