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