| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); | 657 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); |
| 658 } | 658 } |
| 659 | 659 |
| 660 // We can cache the computed property keys if access checks are | 660 // We can cache the computed property keys if access checks are |
| 661 // not needed and no interceptors are involved. | 661 // not needed and no interceptors are involved. |
| 662 // | 662 // |
| 663 // We do not use the cache if the object has elements and | 663 // We do not use the cache if the object has elements and |
| 664 // therefore it does not make sense to cache the property names | 664 // therefore it does not make sense to cache the property names |
| 665 // for arguments objects. Arguments objects will always have | 665 // for arguments objects. Arguments objects will always have |
| 666 // elements. | 666 // elements. |
| 667 // Wrapped strings have elements, but don't have an elements |
| 668 // array or dictionary. So the fast inline test for whether to |
| 669 // use the cache says yes, so we should not create a cache. |
| 667 bool cache_enum_keys = | 670 bool cache_enum_keys = |
| 668 ((current->map()->constructor() != *arguments_function) && | 671 ((current->map()->constructor() != *arguments_function) && |
| 672 !current->IsJSValue() && |
| 669 !current->IsAccessCheckNeeded() && | 673 !current->IsAccessCheckNeeded() && |
| 670 !current->HasNamedInterceptor() && | 674 !current->HasNamedInterceptor() && |
| 671 !current->HasIndexedInterceptor()); | 675 !current->HasIndexedInterceptor()); |
| 672 // Compute the property keys and cache them if possible. | 676 // Compute the property keys and cache them if possible. |
| 673 content = | 677 content = |
| 674 UnionOfKeys(content, GetEnumPropertyKeys(current, cache_enum_keys)); | 678 UnionOfKeys(content, GetEnumPropertyKeys(current, cache_enum_keys)); |
| 675 | 679 |
| 676 // Add the property keys from the interceptor. | 680 // Add the property keys from the interceptor. |
| 677 if (current->HasNamedInterceptor()) { | 681 if (current->HasNamedInterceptor()) { |
| 678 v8::Handle<v8::Array> result = | 682 v8::Handle<v8::Array> result = |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 816 |
| 813 OptimizedObjectForAddingMultipleProperties:: | 817 OptimizedObjectForAddingMultipleProperties:: |
| 814 ~OptimizedObjectForAddingMultipleProperties() { | 818 ~OptimizedObjectForAddingMultipleProperties() { |
| 815 // Reoptimize the object to allow fast property access. | 819 // Reoptimize the object to allow fast property access. |
| 816 if (has_been_transformed_) { | 820 if (has_been_transformed_) { |
| 817 TransformToFastProperties(object_, unused_property_fields_); | 821 TransformToFastProperties(object_, unused_property_fields_); |
| 818 } | 822 } |
| 819 } | 823 } |
| 820 | 824 |
| 821 } } // namespace v8::internal | 825 } } // namespace v8::internal |
| OLD | NEW |