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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 if (result) PROFILE(FunctionCreateEvent(*function)); | 866 if (result) PROFILE(FunctionCreateEvent(*function)); |
867 return result; | 867 return result; |
868 } | 868 } |
869 | 869 |
870 | 870 |
871 OptimizedObjectForAddingMultipleProperties:: | 871 OptimizedObjectForAddingMultipleProperties:: |
872 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, | 872 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, |
873 int expected_additional_properties, | 873 int expected_additional_properties, |
874 bool condition) { | 874 bool condition) { |
875 object_ = object; | 875 object_ = object; |
876 if (condition && object_->HasFastProperties()) { | 876 if (condition && object_->HasFastProperties() && !object->IsJSGlobalProxy()) { |
877 // Normalize the properties of object to avoid n^2 behavior | 877 // Normalize the properties of object to avoid n^2 behavior |
878 // when extending the object multiple properties. Indicate the number of | 878 // when extending the object multiple properties. Indicate the number of |
879 // properties to be added. | 879 // properties to be added. |
880 unused_property_fields_ = object->map()->unused_property_fields(); | 880 unused_property_fields_ = object->map()->unused_property_fields(); |
881 NormalizeProperties(object_, | 881 NormalizeProperties(object_, |
882 KEEP_INOBJECT_PROPERTIES, | 882 KEEP_INOBJECT_PROPERTIES, |
883 expected_additional_properties); | 883 expected_additional_properties); |
884 has_been_transformed_ = true; | 884 has_been_transformed_ = true; |
885 | 885 |
886 } else { | 886 } else { |
887 has_been_transformed_ = false; | 887 has_been_transformed_ = false; |
888 } | 888 } |
889 } | 889 } |
890 | 890 |
891 | 891 |
892 OptimizedObjectForAddingMultipleProperties:: | 892 OptimizedObjectForAddingMultipleProperties:: |
893 ~OptimizedObjectForAddingMultipleProperties() { | 893 ~OptimizedObjectForAddingMultipleProperties() { |
894 // Reoptimize the object to allow fast property access. | 894 // Reoptimize the object to allow fast property access. |
895 if (has_been_transformed_) { | 895 if (has_been_transformed_) { |
896 TransformToFastProperties(object_, unused_property_fields_); | 896 TransformToFastProperties(object_, unused_property_fields_); |
897 } | 897 } |
898 } | 898 } |
899 | 899 |
900 } } // namespace v8::internal | 900 } } // namespace v8::internal |
OLD | NEW |